Creating provisioning profiles for using with TestFlight? - ios

I'm trying to get my app to work with TestFlight by following this article on their website. At step 5 when it says to select your Development Provisioning Profile and Ad Hoc Provisioning Profile, I'm not sure what to do:
Go to the Build Settings tab and scroll down to the Code Signing
section. For the two default build configurations (Debug and Release),
select your Development Provisioning Profile for Debug and your Ad Hoc
Provisioning Profile for Release. Leave Code Signing Entitlements
blank.
How do I create these? The whole provisioning profile thing is so confusing. For my phone I just clicked "Use for development" or whatever and it basically worked to test my app on. Do I have to create something different?
(Yes I'm a registered developer.)

You have to create provisioning profiles for adhoc and distribution.
See http://developer.apple.com/library/ios/ipad/#documentation/ToolsLanguages/Conceptual/YourFirstAppStoreSubmission/TestYourApponManyDevicesandiOSVersions/TestYourApponManyDevicesandiOSVersions.html
Under 'create an AdHoc provisioning profile'

Yes, you'll have to create a Distribution and Development profiles. This is done on http://developer.apple.com/ ...follow the most updated how-to's appl provides or RECENT online tutorials and go for it.
The process used to be incredibly confusing, but has gotten much simpler over the past few years, don't be scared by all the old things your read. Also, many common tasks like renewing profiles are now autmomated in the XCODE organizer. However, creating these in the first place is done using the dev website and Keychain Access.
You may still struggle a bit to get going the first time, but knowing how to work with provisioning is essential if you want to test/share/distribute/sell your apps.

Related

No matching provisioning profiles found (None of the valid provisioning profiles allowed the specified entitlements)

I am getting an error when archiving:
Code Sign error: No matching provisioning profiles found: None of the valid provisioning profiles allowed the specified entitlements: com.apple.developer.in-app-payments.
I added apple pay capability since the last time I archived successfully, so it's probably to do with that. How do I add the entitlements to the provisioning profile? The whole certificates/provisioning profiles/app id concept is so confusing, wondering if there are any good reads (for dummies) on exactly what/why/how these work.
You need to go to developer.apple.com and log in as your developer account. Go to the Certificates, Identifiers, and Profiles section, and find the app ID for your app. Click on it to expend the capabilities for the app ID. Make sure In App Purchases is enabled for both development and distribution (more info here).
Once you've made sure it is there, you'll want to re-generate the provisioning profile for the app ID, and then re-download the profile to your Mac. I tend to remove all my old provisioning profiles when I do this, since having multiple profiles for the same application ID can sometimes confuse Xcode. Provisioning profiles on your Mac are stored in /Library/MobileDevice/Provisioning Profiles/
After doing this, it isn't necessary, but I usually recommend devs to quit and relaunch Xcode.
As for resources, I think Apple's session, What's New in Code Signing, from WWDC 2016 was a great one for understanding the components that are required for code signing to work.
The whole certificates/provisioning profiles/app id concept is so confusing
Not only for you :). You don't have to add entitlements to your provisioning profiles. Try to go to apple developer website add your mac (if you didn't do it already) and generate new provisioning profile. After that download it and click 2 times (xCode should automatically add it to the project). If it doesnt solve the problem try to look into project structure code and change developer/project numbers manually to proper one.

Provisioning profiles status invalid (managed by XCode)

Suddenly all my provisioning profiles are in status Invalid (managed by XCode). Why?
Also I remember in XCode 4 that you always had to create your provisioning profile. Now XCode autocreates your provisioning profile for development. Is this a new feature on XCode 6?
I had the same problem today.
In the Apple Developer website, all of my company's Provisioning Profiles were marked as "Invalid (managed in Xcode)". None were out of them were date, none were using iOS Certificates which had expired, and the website gave zero suggestion that anything was actually wrong.
The solution, ridiculously, was to delete my perfectly valid iOS Certificates, and recreate them.
We write in-house apps aswell as apps for the App Store, and Apple (quietly) refuses to let you have more than 2 of these at once. So I was unable to create a third iOS Certificate which would allow me to use the "In house and Ad-hoc" option, hence the need to delete an iOS Certificate first.
Once I had pointlessly recreated the "iOS Certificate", the Provisioning Profiles came to life.
Part 2 of this farce is to go into Xcode, and delete your Provision Profiles (XCode \ Preferences \ select your iOS Certificate \ View Details, then select all of your provisioning profiles, right click and select "Move to trash".
At this point, absolutely nothing will change, and you'll think you've done something wrong.
But then, if you then quit Xcode, and go back in, then you'll see the Provisioning Profiles will have disappeared.
Now you can re-download the Provisioning Profiles from the Apple Developers website, and redownload the latest versions.
Until Xcode 7.2 comes along, and breaks something else.
(Seriously, I spend more time fighting with Xcode bugs than writing code..)
Apple introduced Xcode Managed profiles in Xcode 5 as a way to try and make the provisioning process less cumbersome and get Developers sending code to their devices without having to go through the manual upload/setup/download/install/build process. In effect, Xcode was completely automating the entire provisioning process whenever there was a code sign error detected. For developers that had already wrestled with understanding Provisioning, this new behavior was frustrating as the processes those teams put in place were unintentionally being wrecked by Xcode's best attempts to be helpful. That said, it is better today but not as transparent as it should be when it comes to affecting your Certificates, Identities, and Profiles data. If you are't familiar with what all is included in a provisioning profile or signing identity, there's some related reading you might want to skim: What are code signing identities?
Suddenly all my provisioning profiles are in status Invalid (managed by XCode). Why?
The most common reason for a profile to move to the "Invalid" state is because at least one of the profile's registered test devices has been deactivated / removed from the developer's account. By doing so, all profiles that included that device UDID are marked as invalid and require regeneration. This can be accomplished in Xcode > Preferences > Accounts, clicking 'View Details' on your Apple ID account, and then clicking the refresh button in the lower right corner of that account details screen.
Also I remember in XCode 4 that you always had to create your provisioning profile. Now XCode autocreates your provisioning profile for development. Is this a new feature on XCode 6?
As stated in the start of this answer, no. Autogenerated provisioning profiles were introduced in Xcode 5 and the workflow has been refined several times since Xcode 5.0 and modern Xcode. If you allow Xcode to assist you with Code Signing error messages, its default position is to check the validity of your development or distribution certificate (depending on what kind of code sign operation you were trying to do), check the validity of the AppId and Provisioning Profile, and revoke then reissue whichever part of the signing identity is in error.
Really it messing up on me. it destroyed my 4 hours fighting with Xcode. At last created another new provisioning file with selecting appleID as iOS Wildcard App ID (xxx.*)

iOS Distribution Provisioning Profile invalidates itself when new devices are added

I've got a Distribution Provisioning Profile I use for distributing my application to QA testers via AdHoc builds / HockeyApp. I'm also part of a team of other developers working on other apps, and they have their own QA teams.
Whenever someone else adds a device to the Apple Developer Member Center (previously the "Provisioning Portal") located at https://developer.apple.com/membercenter/index.action , the Distribution Provisioning Profile becomes Invalid.
To make the profile valid again, I must open up the profile and include all of the newly added devices in the profile, then re-download it.
This is all fine, but it seems unnecessary. My Distribution Provisioning Profile should only need the devices of my app's testers linked to it, not the devices others have added for their own testing purposes.
Does anyone have any information / links to documentation on why this happens (searches only seem to bring up the common issues with provisioning profiles in general that people always run into when starting out), and whether or not there is a way to get around it?
Thanks,
- Adam

"TestFlight Users In The Provisioning Profile" doesn't coincide with users in the AdHoc provisioning profile

I have created a totally new TestFlight account, when I add the build to the account I see 79 users under TestFlight Users In The Provisioning Profile. The problem is that I have built the application using an ADHoc provisioning profile that contains just 3 devices, so why I'm seeing the full list of devices that I've registered with the Apple Developer Portal and not just the device that are available in the Provisioning profile (as stated by the sentence TestFlight Users In The Provisioning Profile) ?
I occasionally run into this problem and get it working again after trying a few things.
Restart Xcode. (It's amazing how often that solves the problem.)
Make sure that you are bundling the correct provisioning profile with the app when archiving and exporting. If you're using Xcode 6, the process has been changed a bit and you might be including the wrong profile. (Look in your Build Settings and then also look at the details on each screen as you are exporting the archive.)
Try re-generating your provisioning profile.
Make sure you have refreshed your account in Xcode so that it has the latest provisioning profile.
If those don't work, try creating a new signing certificate and generating your profile with that.
Then refresh your account in Xcode again.
If that's still not working, try removing your account from Xcode completely, restarting Xcode, and adding your account again.
Those are some of the tricks I use to get things working again. Maybe there is a more definitive answer out there.
I have also face the same problem.
This is because the provisioning profile you create from apple developer account.
Have that 79 devices register with that apple developer account.
Please check that account once.

iOS provisioning profiles and signing identities

I am a bit lost in all the certificates/provisioning profiles.
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?
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?
On the other hand, testflight instructions (http://help.testflightapp.com/customer/portal/articles/1333914) 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?
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.
Can someone please shed some light and explain how is it actually supposed to be working?
Thanks
Yes, your build settings matter. Xcode picks up various entitlements from your initial code signing/provisioning profile configuration and it only makes minimal changes to them in the Distribute... phase.
So if Xcode chooses the incorrect profile during the Archive step you can end up with incorrect bundle seed ID, keychain groups, APN environment and iCloud entitlements.
The Distribute... button calls the PackageApplication script, which makes sure that get-task-allow is false (debuggers can't connect), embeds a provisioning profile, then re-signs and zips your app (although I may have the order wrong).
PackageApplication is worth reading. One could fault it for not being very smart, but I think it should be stricter and refuse to package an app whose entitlements differ from the provisioning profile it is using.
You can find it here Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication
I think one stable workflow for distributing Ad Hoc builds is
remove all wildcard provisioning profiles from your system
select your App Store profile in Release Configuration (used in Archive phase)
in Distribute select your Ad Hoc profile
The reason for 1. is that wildcard profiles (profiles that match multiple BundleIDs, created either manually by you or automatically by Xcode) are not worth the trouble. Yes, they get you running code on a device quicker, but you soon have to abandon them if you want to use push notifications or any other interesting service and then they hang around on your system and sooner or later Xcode will silently pick one of them and sabotage your App Store submission.
As for point 2. (selecting the App Store provisioning profile), I'm a little hesitant of specifying profile in the project, but the App Store one only needs to change once a year when your certificate expires (unless you edit the App Identifier in the Certificates, Identifiers & Profiles portal, then you'll need to regenerate your profile & re-select it in your project settings).
Since the Ad Hoc and App Store profiles are based on the same App Identifier, their entitlements will always be in sync.
Point 2. should make point 1. unnecessary, but wildcard profiles will also happily screw up your dev builds too, so why give them the chance to stab you in the back?
Point 3. - you can change your Ad Hoc profile as much as you like - just remember to select the right one in Distribute; the entitlements are taken from the App Store profile which should change rarely. There's nothing stopping you distributing to the App Store from here. That's perfectly natural.
p.s. I don't know why TestFlight recommend selecting Ad Hoc in release instead of App Store.

Resources