0

When I go to do an adhoc build I need to set the provisioning profile in the target settings for adhoc, the project settings for adhoc and finally when it's built and ready to distribute I click in the new organizer pop up 'Distribute' and need to set the adhoc profile again.

I think I'm missing some understanding here, why do I need to set this profile 3 times? Is there not just one place I can enter it (like in the organiser/distribute button stage) instead?

Of if this is indeed the process can anyone shed any light on why it's needed 3 times?

sradforth
  • 2,176
  • 2
  • 23
  • 37

1 Answers1

1

First of all, the target settings will override the project settings. Build settings cascade down similar to CSS, and you can see this more clearly by enabling the "Levels" option when viewing the build settings for your target:

enter image description here

The green highlighted boxes show where the final resolved settings come from. So in the above screenshot you can see that the code signing is taken from the target settings. The values at the project level are ignored/overriden.

Generally you want to avoid these multiple levels of settings because it can get confusing and you have redundant information.

Your debug identity should almost always be set to "iPhone Developer" under the "Automatic Profile Selector" group, and should be defined at the project level (since it will be the same for all targets). You can delete this setting at the target level by selecting the entry in the target settings and hitting delete. The green highlight should now appear at the project level:

enter image description here

For your release and adhoc configurations, you probably do want to choose a specific signing identity at the target level, since you could theoretically have multiple application targets in one project with different settings. At the project level it's best to choose the generic "iPhone Distribution" (Automatic Profile Selector) option which will then be overridden.

When you build your application on the command line or archive it from Xcode, the application is built and signed with these settings, and an appropriate provisioning profile is embedded.

If you choose the "Distribute" option from the Organizer, this archived application can be completely resigned, which is why you are prompted again for a provisioning profile. This means a third-party developer can develop an application for you, archive it with their own signing information, send it to you, and you can then resign with your own private key and provisioning profile for the app store.

It should be possible to skip this final resigning stage, but I'm guessing too many people have made mistakes in the past so Xcode just takes over and does everything again for you.

Mike Weller
  • 45,401
  • 15
  • 131
  • 151
  • Thank you for writing such a comprehensive and excellent answer, that last part with the distribution resigning is the main bit of confusion for me. It seemed like putting anything in the 'distribute' section for project or target is unnecessary. If I've understood correctly it seems like I can set project/target distribute provisioning profile to 'X' (or nothing) yet when it pops up in organizer->distribute I can change the profile entirely to 'Y' and it will work? Let me know if I've misunderstood this bit though as it does seem odd you can set the dist/adhoc profiles in target/project – sradforth Sep 02 '12 at 07:42
  • In theory yes, you could have a completely different 'X' configured in the project/target settings, then choose 'Y' during the Organizer's distribution phase. You have to remember that the Organizer's Distribute functionality didn't exist at one point. The application was built with the project/target settings, and that's what was submitted to the store by the developer. This is still the case if you are building your application from the command line for example. – Mike Weller Sep 03 '12 at 12:24