com.apple.dt.MobileDeviceErrorDomain

解决方案

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

image.png

修改为


image.png

运行环境

macOS:macOS Big Sur 11.4
iOS:14.6
iPhone:iPhone XR
Xcode:Version 12.5 (12E262)

情况描述

真机调试报这样一个错误:


Unable to install.png

展开Details如图


details.png

原因分析

第3方SDK导致的签名问题
通过file命令,得到结果是

file GMService.framework/GMService

输出结果为

current ar archive random library

说明是一个静态库,我们选择 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).

不要嵌入静态框架和库(链接发生在构建时),只嵌入共享的框架和库(动态链接发生在运行时,所以它们需要在你的包中)。

file frameworkToLink.framework/frameworkToLink will return:

  • current ar archive: static library, select Do not embed
  • Mach-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 的区别

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 机翻

链接--如果我们使用一个框架中定义的任何API,我们必须链接该框架。
嵌入--这个过程将确保添加的框架将被嵌入到应用程序包中,并可能有助于在应用程序和任何扩展包之间共享代码。我们只嵌入第三方框架,而不是iOS提供的框架,因为它们在设备中是现成的。如果我们嵌入,这意味着,我们也需要链接到它们,以便Xcode可以编译和创建构建。当应用程序在设备中运行时,嵌入式框架将在需要时被加载到内存中。

你可能感兴趣的:(com.apple.dt.MobileDeviceErrorDomain)