简体   繁体   English

框架在自动生成的 swift 文件中不可见

[英]Framework not visible in auto-generated swift file

I want to import some swift classes in objective-c project.我想在objective-c 项目中导入一些swift 类。 I added all classes, I created the bridging-header, I imported the MyTarget-swift.h file in my classes and everything seems working fine.我添加了所有类,创建了桥接头,在我的类中导入了 MyTarget-swift.h 文件,一切似乎都正常。

When I'm building the project, I found a very strange error on generated swift.h file:在构建项目时,我在生成的 swift.h 文件中发现了一个非常奇怪的错误:

在此处输入图片说明

StoreKit framework is already added to project. StoreKit 框架已添加到项目中。 I have no idea what is going on.我不知道发生了什么。 Anybody has any idea?有人有什么想法吗?

The right answer is this: https://stackoverflow.com/a/24195188/4563329正确答案是这样的: https : //stackoverflow.com/a/24195188/4563329

That helped me to fix my problem.这帮助我解决了我的问题。 I will post my fixed file here:我将在这里发布我的固定文件:

I created another header file in objective-c named ModuleTargetName-Swift-Fixed.h Inside of it first I imported StoreKit and after I imported ModuleTargetName-Swift.h .我在 Objective-c 中创建了另一个名为ModuleTargetName-Swift-Fixed.h头文件,在其中首先导入StoreKit ,然后导入ModuleTargetName-Swift.h In my objective-c classes I imported ModuleTargetName-Swift-Fixed.h在我的 Objective-c 类中,我导入了ModuleTargetName-Swift-Fixed.h

This is my class:这是我的课:

// Forward declarations for property classes
#import <StoreKit/StoreKit.h>

// Imports for superclasses
#import "ModuleTargetName-Swift.h"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Swift - 框架中的共享核心数据 - 自动生成的类不公开? - Swift - Shared Core Data in Framework - auto-generated classes aren't public? 永久更改.mlmodel自动生成的文件 - Change .mlmodel auto-generated file forever 如何编辑由 Firebase 动态链接自动生成的 apple-app-site-association 文件? - How to edit the apple-app-site-association file auto-generated by Firebase Dynamic Links? 升级到XCode 6.3.2后(使用Objective-C而不是Swift),核心数据模型找不到自动生成的实体类 - Core data model not finding auto-generated entity classes after upgrading to XCode 6.3.2 (using Objective-C rather than Swift) 如何使用协议扩展为类提供自动生成的标识符? - How to use protocol extension to provide auto-generated identifier for classes? 关于通过核心数据自动生成代码的快速问题 - Quick question about auto-generated code via core data 自动生成的核心数据访问器返回已删除的对象 - Auto-generated Core Data accessor returns deleted objects 如何使用Phonegap更改自动生成的窗口的位置? - How can I change the position of auto-generated windows with Phonegap? 使用自动生成的objectId或为Parse中的映射类创建自己的唯一ID - Use the auto-generated objectId or create your own Unique ID for mapping classes in Parse 为什么自动生成的iOS Apple代码使用实例变量而不是属性? - Why does auto-generated iOS Apple code use instance variables instead of properties?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM