[英]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.