tl;dr
将您的嵌入式框架与其他框架链接,但不将其他框架与您的应用链接,在设备上构建并运行时会导致required code signature missing
。
描述:
设定:
我的设置非常简单(Swift 2.3和Xcode Xcode 8.0;构建版本8 S162 m):
- 使用Carthage(0.17.2),我构建了其他.框架,其中包含
xcodebuild
8.0和TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 carthage build --platform iOS
*我的应用程序已嵌入我的框架。 - 应用程序和框架项目位于一个Xcode工作区下。
- 我只将Other.framework链接到My.framework(这意味着,MyApp根本没有链接到Other.framework)。这里的要点是,MyApp不需要使用Other.frameworkAPI。
问题:
一切似乎都运行正常,直到我在设备上构建并运行应用程序。应用程序启动,然后进程中止,并出现以下Xcode错误:
dyld: Library not loaded: @rpath/Other.framework/Other
Referenced from: /private/var/containers/Bundle/Application/DCF0331F-FF23-43CF-AE79-B3857D5A6EE3/MyApp.app/Frameworks/My.framework/My
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/DCF0331F-FF23-43CF-AE79-B3857D5A6EE3/MyApp.app/Frameworks/My.framework/Frameworks/Other.framework/Other: required code signature missing for '/private/var/containers/Bundle/Application/DCF0331F-FF23-43CF-AE79-B3857D5A6EE3/MyApp.app/Frameworks/My.framework/Frameworks/Other.framework/Other'
我已经检查了Other.framework的签名,看起来没问题。而且,
解决方案(解决方法)
将MyApp与Other.framework链接。太可怕了...这感觉很糟糕。
将完全相同的二进制文件Other.framework链接到MyApp,并通过这种方式解决问题,指出Other.framework构建良好,能够正确地重新签名。可能与Carthage无关。
注:iOS 8+ framework with nested embedded framework也有类似问题,但我的问题有其他原因。
3条答案
按热度按时间ghg1uchk1#
这个问题与嵌套框架无关。它完全是关于代码设计验证。dyld报告Other.framework缺少代码设计。您需要对框架进行签名。这应该由Xcode来完成,所以我很好奇Other.framework是如何构建的。
您可以通过签署来解决此问题。
或者只是彻底放弃你的应用程序:
ny6fqffe2#
我通过以下guidance修复了我的确切问题
您不需要将您的“Other.framework”链接到您的MyApp。只需添加运行脚本来签署需要代码签名的任何嵌入框架即可
6yoyoihd3#
讨论Carthage github page上的这个问题,很明显,问题中提到的解决方法实际上是一种预期行为:
Carthage不支持嵌套框架。
嵌套框架并不能让你重用这些框架。例如,如果
A.framework
和B.framework
都依赖于Other.framework
,那么它们都不能嵌套Other.framework
-否则你可能会得到两个不同的版本,并且在运行时可能不会选择正确的版本。正确的做法是将其作为依赖项列出,但将其链接到应用程序目标。
充分讨论:Linking only embedded framework with other dynamic framework fails when build & run on device: "required code signature missing"
这在README中并不清楚,所以我提出了另一个问题,要求更新文档:
Update to README: Linking dynamic frameworks to embedded frameworks requires as well linking them to the app target #1427
在PR范围内解决并关闭该问题:
#1427 README upd: link dependencies from embedded frameworks to the app target