我刚刚在swift中创建了一个框架,它在swift项目中运行良好,但在目标c中我得到的错误就像 Undefined symbols for architecture armv7:
. 我刚刚使用 lipo -info
检查了可用的架构,它显示了模拟器和设备架构 . Also I referred this link but no use . Attached image also.我会感激任何帮助,谢谢 .
我刚刚在swift中创建了一个框架,它在swift项目中运行良好,但在目标c中我得到的错误就像 Undefined symbols for architecture armv7:
. 我刚刚使用 lipo -info
检查了可用的架构,它显示了模拟器和设备架构 . Also I referred this link but no use . Attached image also.我会感激任何帮助,谢谢 .
2 回答
要访问objc中的swift类,这不是从NSObject继承的,您需要:
@objc public class yourUtils
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
以下是您的框架中的待办事项列表 .
Objective C类中的Swift类用法
在Swift中使用类名之前的Open Keyword
在Swift类的Open Keyword之前使用@objc关键字
在Umbrella文件中导入目标c类的所有 Headers . 您正在使用Swift类 .
在Objective c中使用#import
我遵循Apple Mix and Match方法 . 希望这会有所帮助 . 谢谢