Embedded binary is not signed with the same certificate as the parent app#
背景#
Xcode 10 之后 New Build System 变为默认,编译之后一直报错,
报错信息:Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target’s code sign settings match the parent app’s.
eg:
但是在 Legacy Build System 下就没有问题。刚开始直接粗暴的改回 Legacy Build System,一直没来得及查具体原因,最近得空了,仔细查了一下。
过程#
搜到的好多人说,是因为 keyChain 里证书的信任状态不对,要用系统默认,不能强制始终信任。but,我检查了之后,我的证书确实是系统默认的状态。
在 stackoverflow 上iOS error “Embedded binary is not signed with the same certificate as the parent app”
这里面:
- 被采纳的是:widget target 下的 Code Sign Identity,没有设置或者设置的和 main app target 下的不一致。但是,对于我来说,我检查了之后发现也与我状况不同。报错信息里就有不同,在 Embedded Binary Signing Certificate: 里,一个是 Not Code Signed,一个是 Software Signing,所以,这个解对于我也不对
- 第二个被赞成多的答案是:keyChain 里证书的信任状态不对,要用系统默认,不能强制始终信任。这个也已经验证过了,不是我的正解
- 第三个被赞最多的给出解决方法是:改回 Legacy Build System。。。。这个我之前一直是这样,但是我需要解决这个问题,而不是逃避,而且我还想看一下用 New Build System 能加快多少编译时间
- 其次一个,说 widget 的 depolyment target,比 main app 的高,也被我 pass 了
- 再一个,说把 Watch target 的”Build Settings”> “Valid Architectures” 改为
$(ARCHS_STANDARD),这个我还真没验证,因为我直接用楼下一个的编译好了,但是这楼的答案被我用于消除一些个编译警告了。。。。在另一篇博客里说
- 终于,这一楼说在 main app target 里 Build Phases 中,Embed App Extensions 里,勾选 Copy only when installing. Finally,解决了,这一楼是对我的正解。
结果#
遇到了报错,不要慌,先看报错信息,理解报错信息的意思,搜索别人解决方法时,仔细观察报错信息是否一样,尝试,如果结果不合适,不要气馁,往楼下看,一一仔细看,总有一楼合适。。。。。哈哈哈