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可以编译和创建构建。当应用程序在设备中运行时,嵌入式框架将在需要时被加载到内存中。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 原文链接[http://chuquan.me/2021/02/14/understand-ios-library-...
    baochuquan阅读 5,566评论 0 5
  • 一、库的概念 库(Library) 就是一段编译好的二进制代码,加上头文件就可以供别人使用。 什么时候会用到库? ...
    MeteorCode阅读 4,172评论 0 0
  • 在其它大部分平台上,动态库都可以用于不同应用间共享, 共享可执行文件,这就大大节省了内存。iOS平台 在 iOS8...
    CodingTom阅读 7,853评论 0 1
  • 原文链接 苹果已经为我们提供了各式工具, 可以将一个复杂的 APP 分解为若干的 module, library ...
    貘鸣阅读 3,030评论 0 0
  • 表情是什么,我认为表情就是表现出来的情绪。表情可以传达很多信息。高兴了当然就笑了,难过就哭了。两者是相互影响密不可...
    Persistenc_6aea阅读 126,861评论 2 7