我正在尝试为 iOS 应用程序制作一个动态框架。感谢新版本的 Xcode (6),我们可以在创建新项目时选择 Cocoa Touch Framework,不再需要添加聚合目标、运行脚本等来制作。构建框架时我没有问题。但是当我尝试在 iOS 应用程序中使用它时,我遇到了一些架构问题。
ld: warning: ignoring file /Library/Frameworks/MyFramework.framework/MyFramework, file was built for x86_64 which is not the architecture being linked (arm64): /Library/Frameworks/MyFramework.framework/MyFramework
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_MyFrameworkWebService", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: ignoring file /Library/Frameworks/MyFramework.framework/MyFramework, file was built for x86_64 which is not the architecture being linked (armv7): /Library/Frameworks/MyFramework.framework/MyFramework
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_MyFrameworkWebService", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
好吧,我尝试更改框架项目和目标的设置(架构和仅构建有效架构和有效架构)。我为 iOS 应用程序项目做了同样的事情,但没有任何效果。我觉得有些东西我不明白。
例如,当我使用命令行“xcrun lipo -info MyFramework”为仅 i386(iOS 模拟器)检查构建框架时,我遇到的问题是
ld:警告:忽略文件/Library/Frameworks/MyFramework.framework/MyFramework,文件是为x86_64构建的,它不是被链接的架构(i386)......
如果有人可以帮助我获得适用于所有 iOS 架构(包括模拟器)的框架。