title: iOS provisioning profiles and signing identities
body: <p>I am a bit lost in all the certificates/provisioning profiles.</p>
  
  <p>When I am doing ad-hoc distribution by first doing "archive" and then "distribute" in XCode and chose then my ad-hoc distribution profile, does it matter at all what I have set up in the  Project->Target->Build Settings->Code Signing?</p>
  
  <p>On one hand I read in different places that when you archive a build, you can (and really should) use that same archive both for beta testing with ad-hoc and then when ready just sign/distribute the same archive with an appstore profile and upload to app store. That kind of makes sense. It also tells me that I can really leave blank the provisioning profile in the project settings, the one that is chosen during "distribute" action is actually used, and the signing identity is actually the private key associated with the distribution certificate listed in that provisioning profile. Right?</p>
  
  <p>On the other hand, testflight instructions (<a href="http://help.testflightapp.com/customer/portal/articles/1333914" rel="nofollow">http://help.testflightapp.com/customer/portal/articles/1333914</a>) clearly state that project settings should be set to use Ad-hoc profile as well, and the same profile must be used in the project settings and in "distribute". That means that I can not use the same archive both for ad-hoc and app-store distribution, can I? Do I need to change project settings every time I want to release for this or that distribution?</p>
  
  <p>Also, if project settings are making any differences in archive/distribute scenario, it is not clear what Code Signing Identity should be used there. Testflight screenshots show iOS Developer is set both for debug and release, yet neither ad-hoc nor app store distribution have the individual iOS developer certificate associated with them, distribution profiles usually are associated with one and one only distribution certificate.</p>
  
  <p>Can someone please shed some light and explain how is it actually supposed to be working?</p>
  
  <p>Thanks</p>