解決方案
修改 TARGETS -> General -> Frameworks, Libraries, and Embedded Content 下
新引入的Framework 的 Embed 方式

修改為

運(yùn)行環(huán)境
macOS:macOS Big Sur 11.4
iOS:14.6
iPhone:iPhone XR
Xcode:Version 12.5 (12E262)
情況描述
真機(jī)調(diào)試報(bào)這樣一個(gè)錯(cuò)誤:

展開(kāi)Details如圖

原因分析
第3方SDK導(dǎo)致的簽名問(wèn)題
通過(guò)file命令,得到結(jié)果是
file GMService.framework/GMService
輸出結(jié)果為
current ar archive random library
說(shuō)明是一個(gè)靜態(tài)庫(kù),我們選擇 Do not embed
什么是Embedding和Signing
Embedding
Do not embed static frameworks and libraries (linking happens at build time), only shared ones (dynamic linking happens at run time, so they need to be in your bundle).
不要嵌入靜態(tài)框架和庫(kù)(鏈接發(fā)生在構(gòu)建時(shí)),只嵌入共享的框架和庫(kù)(動(dòng)態(tài)鏈接發(fā)生在運(yùn)行時(shí),所以它們需要在你的包中)。
file frameworkToLink.framework/frameworkToLink will return:
current ar archive: static library, select Do not embedMach-O dynamically linked: shared library, select Embed
Signing (only if shared/embedded)
Not required if it already has a proper signature (adhoc doesn't count).
codesign -dv frameworkToLink.framework will return:
- code object is not signed at all or adhoc: select Embed and sign
- anything else: already properly signed, select Embed Without Signing
Embedded Binaries 和 Linked Frameworks 的區(qū)別
what is the difference between Embedded Binaries and Linked Frameworks
Linking- We must link a framework if we use any API defined in it.
Embedding - This process will ensure the added framework will be embedded within the App bundle, and potentially will help sharing code between the app, and any extension bundles. We embed only third party frameworks and not the ones provided by iOS as they are readily available in the device. If we are embedding, that means that, we will need to link to them too so that Xcode can compile and create the build. When the app runs in the device, then the embedded framework will be loaded into memory when needed.
deepL 機(jī)翻
鏈接--如果我們使用一個(gè)框架中定義的任何API,我們必須鏈接該框架。
嵌入--這個(gè)過(guò)程將確保添加的框架將被嵌入到應(yīng)用程序包中,并可能有助于在應(yīng)用程序和任何擴(kuò)展包之間共享代碼。我們只嵌入第三方框架,而不是iOS提供的框架,因?yàn)樗鼈冊(cè)谠O(shè)備中是現(xiàn)成的。如果我們嵌入,這意味著,我們也需要鏈接到它們,以便Xcode可以編譯和創(chuàng)建構(gòu)建。當(dāng)應(yīng)用程序在設(shè)備中運(yùn)行時(shí),嵌入式框架將在需要時(shí)被加載到內(nèi)存中。