-->

Where does xcode take application's Identifier

2020-02-19 09:12发布

问题:

I think my head soon explode. I've been working on my application for some time and finally git an iPhone for testing on device, now I'm trying to run my app on iphone but can't do it. I've done all necessary steps but getting an error [BEROR]Code Sign error: a valid provisioning profile matching the application's Identifier 'com.yourcompany.MyProject' could not be found

My provisionign profile is called XXXXXXXXX.com.myname.*

in info.plist I changed Bundle identifier to com.myname.myapplication

my project name is MyProject because I can't change it, but my target and executables called myapplication

I've checked all setting and can't even find this yourcompany anywhere

but still getting this error

where need I seek?

thank you

回答1:

Xcode uses the bundle identifier found in the target's Info.plist file for code signing.

Which Info.plist file is selected is actually a build setting (normally in the target), and is usually set up by Xcode correctly. If you manually edited the Info.plist's bundle identifier value to your identifier, Xcode should use this identifier and code signing should work.

The default Info.plist file contains a bundle identifier that contains Xcode build settings and is processed to the final identifier when building the target.



回答2:

The answer by Nikolai Ruhe said "If you manually edited the Info.plist's bundle identifier value to your identifier, Xcode should use this identifier and code signing should work." This is true. However, these days (I'm not sure how it was in Sep 2010), xcode uses a default bundle identifier that is a function of the variable ${PRODUCT_NAME}. This same variable is used in various other places, e.g., as bundle name, bundle display name, etc. Thus, I would recommend changing ${PRODUCT_NAME} instead, and this change will then propagate to the Info.plist's bundle identifier, etc.

How to change ${PRODUCT_NAME}? Select the appropriate target, go to "build settings", expand the "packaging" section, and then edit the value of "Product name".



回答3:

Select your target, go to summary. Change bundle identifier to com.myname.myapplication from com.yourcompany.MyProject. It should work! I have been using it like this and it works great everytime. You can do the same from info.plist file as well.