How to become familiar with code signing issues?

2019-03-21 14:54发布

Every time when i deal with code signing and provisioning profiles strange things happens. Most times i get the error "no code signing identity found" and if not then something like "no matching provisioning profiles found" and "no provisioning profiles with a valid signing identity".

Although i am quiet familiar with the theory and the things behind code signing and provisioning, there are still lots of pitfalls I everytime ran into and i don't know how to deal with. Sometimes it fails when setting up a new App, sometimes not.

enter image description here

There are 5*2 different ways to select code signing identity. What is the difference between them? And if i select one for debug and one for release, what is the reason for the "Any iOS SDK"?

Also, there are two places giving this dialog: Project-Settings -> Buildsettings is the first place, and also for the Target under Build Settings. Both are not in sync, so if i change the code signing at the first place, i have to change it twice in the second place. Is there a way to keep them in sync?

Which code signing identity would fit best into the various lines (debug, debug -> any ios sdk, release, release -> any ios sdk), since i can choose between developer identities and distribution identities (i could imagine, that the distribution one is for release and the developer one is for debug, but because of everything fails, i don't know.

What I did:

There a valid certificates in the Member Center deposited for each developer of our team and one for ad hoc distribution for the Team. We also created AppIDs which reflects exactly the same setting in the Project Settings. In between we avoid using Variables and use the exactly appid also in project-settings to reduce risks on this side and to simplify things.

When switching the provisioning profile from "Automatic" to a specific Profile for this App, the code signing identities change to different values, which are also not in sync between the project settings and target build settings:

On the Target->Build Settings we get this result: enter image description here

On the Project -> Build Settings we get a different result: enter image description here

Which one would be more accurate? After "Product" -> "Archive" -> "Validate" we get the following error:

enter image description here

It doesnt matter here if we select different Code signing identities or not. Actually, just for playing 'trail-and-error', we tried out nearly every multiple combinations of code signing identities to learn what XCode would do then.

After this error message from Archive->Validate the previous selected provisioning profile is replaced with another one named by a randomly generated string:

enter image description here enter image description here

Who can tell me what happens here and how to solve these issues?

I've read a lot of documents regarding this topic. But most tutorials around this topic are outdated since several changes happened between XCode 4 and XCode 6. Even the apple documents offer mostly screenshots based on outdated XCode versions and also outdated versions of Member Developer Center.

Update

As Ian McDonald pointed out correctly, the last question (covered by the last 2 screenshots) is answered. After recreating the Provisioning Profile it won't be replaced by randomly generated strings, but the IPA-creation is still not working with "no code signing identities found".

What it looks like now: enter image description here

2条回答
冷血范
2楼-- · 2019-03-21 15:01

you have a long question , but If you face problem with archive or publish your app there are some steps you should follow

First code signing

If you build your app with Debug , then debug must sign with iPhone developer --> general if you use many or specific one "depend of certificate you have in your key-chain "

but If you build your app with release then you should you certification iPhone distribution ---> general or specific one

Second Provisioning Profile

If you build with Debug then the provision profile Debug should match match your bundle detail and be development

release be distribution one that you create on developer apple site

I hope this help you have a look at this also please

查看更多
Emotional °昔
3楼-- · 2019-03-21 15:12

From what I'm reading you have changed your provisioning profile in your target from "xxx.xxx" to "xxx.xxxTests" which is in fact a different bundle identifier making the error valid. You really have two courses of action:

  1. Change your bundle identifier back to just "xxx.xxx". This is the appropriate path of least resistance.

  2. Create a new bundle identifier in the portal as "xxx.xxxTests" as well as a new provisioning profile for "xxx.xxxTests" tied to the same certificate. With XCode closed drag the new provisioning profile onto your XCode app icon then open your project.

You shouldn't have to change your bundle identifier to conduct testing. When you go to deploy you will only have to change which provisioning profile your target is compiling with (development vs distribution).

EDIT: I have some more tips on provisioning profiles here: How to become familiar with code signing issues?

The quick and dirty side of provisioning works like this:

  • When you are added to the Apple Provisioning Portal your cert is the keys to the castle. Any code you compile has to be associated with your cert or you won't be able to properly compile/export your code.
  • Your bundle identifier is essentially the way iOS identifies your application. Conceptually speaking if you want to install your app multiple times on the same device create multiple bundle identifiers.
  • Your provisioning profile ties all of the pieces together. The prov profile tells XCode that you plan on using your cert to compile your app identified by your bundle identifier. If it's a development build it will only the devices specifically assigned to the prov profile in the portal will be able to install your app.

Within XCode you need to make sure your target bundle identifier matches what bundle identifier is in the provisioning profile. Likewise make sure your code signing identity matches the cert you setup in the portal and tied to the provisioning profile. Lastly select the appropriate provisioning profile from the drop down list below the code signing identity.

查看更多
登录 后发表回答