今是昨非

今是昨非

日出江花红胜火,春来江水绿如蓝

Embedded binary is not signed with the same certificate as the parent app

Embedded binary is not signed with the same certificate as the parent app#

Background#

Since Xcode 10, the New Build System has become the default, and after compilation, an error keeps occurring,
Error message: 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:

bcHlsryZAwaPSN3.png

However, there is no problem when using the Legacy Build System. At first, I directly switched back to the Legacy Build System without checking the specific reason. Recently, I had some free time and looked into it carefully.

Process#

I found that many people said it was because the trust status of the certificate in the keychain was incorrect and should be set to the system default instead of being forced to always trust. However, after checking, my certificate is indeed in the system default state.

On Stack Overflow, there is a post titled iOS error “Embedded binary is not signed with the same certificate as the parent app”.

In this post:

  1. The accepted answer is: the Code Sign Identity of the widget target is not set or is inconsistent with the main app target. However, for me, after checking, I found that it is different from my situation. The error message contains the difference, in the Embedded Binary Signing Certificate section, one is Not Code Signed, and the other is Software Signing. Therefore, this solution is not applicable to me.
  2. The second most upvoted answer is: the trust status of the certificate in the keychain is incorrect and should be set to the system default instead of being forced to always trust. I have also verified this, but it is not the correct solution for me.
  3. The third most upvoted answer provides a solution to switch back to the Legacy Build System... I have been using this method before, but I want to solve this problem instead of avoiding it, and I also want to see how much faster the compilation time can be with the New Build System.
  4. Another suggestion is to set the deployment target of the widget higher than the main app, but I have already passed this.
  5. Another suggestion is to change the "Build Settings" > "Valid Architectures" of the Watch target to

    $(ARCHS_STANDARD). I haven't verified this because I directly used the solution provided in the next post, but I used the answer in this post to eliminate some compilation warnings... as mentioned in another blog post.

  6. Finally, this post suggests that in the main app target's Build Phases, under Embed App Extensions, select "Copy only when installing." Finally, the problem is solved. This post is the correct solution for me.

YgqMdLSO7JsiFuP.png

Result#

When encountering an error, don't panic. First, look at the error message and understand its meaning. When searching for solutions from others, carefully observe if the error message is the same. Try the solutions, and if the results are not suitable, don't be discouraged, look at the next post, and carefully read each one. There is always a suitable solution... Hahaha

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.