Signing iOS App: App ID Cannot be Registered to Your Development Team - ios

I need to replace a deployed iOS native app with a new Ionic3 / Cordova hybrid app. The new hybrid app builds successfully (on macOS Sierra 10.12.6) but I can't sign the app (so that it can be uploaded to the app store).
As a first step, I'm focused on getting the new app on the app store (as alpha to test with TestFlight). I've removed all "development" certificates/profiles from developer.apple.com.
There's a lot of information/questions/answers on the web about signing apps. I've spent a couple of days on this issue and cannot get it to work no matter what I read or what I try.
The current iOS app code (deployed)
In Info.plist, $(PRODUCT_BUNDLE_IDENTIFIER)
In /bbh.xcodeproj/project.pbxproj, PRODUCT_BUNDLE_IDENTIFIER = "NSP.BBH-Mobile";
Re-create development provision
Open Keychain. Delete all developer/iPhone certificates. Delete all keys.
On developer.apple.com, delete development certificate and development provisioning profiles.
Confirm my iPhone device is registered with the correct UDID.
In Keychain, generate a certificate signing request file.
In developer.apple.com, create a development certificate, upload the certificate signing request generated in the previous step, download the certificate .cer file.
Double click on the .cer file. Keychain opens. Choose to add to "log in".
In Keychain > certificates, choose export, specify the strong password. Certificates.p12 file will be generated.
In developer.apple.com, create a development provisioning profile. Choose "iOS App Development". Choose an App ID ... but which one?
App IDs in developer.apple.com
BBH Mobile = com.bbh.*
BBH Mobile = NSP.BBH-Mobile
Xcode iOS Wildcard App ID = *
Notice on-screen reads:
"If you plan to use services such as Game Center, In-App Purchase, and Push Notifications, or want a Bundle ID unique to a single app, use an explicit App ID.
If you want to create one provisioning profile for multiple apps or don't need a specific Bundle ID, select a wildcard App ID. Wildcard App IDs use an asterisk (*) as the last digit in the Bundle ID field.
Please note that iOS App IDs and Mac App IDs cannot be used interchangeably."
We need push notifications so choose an explicit App ID = AYW4J8P7X3.NSP.BBH-Mobile
app id = team id (generated by apple) + bundle id (supplied by the user)
It makes sense to choose this App ID which includes the bundle id of the iOS currently deployed.
https://www.screencast.com/t/C0QdPdxwh09t
Choose a development certificate (just created), choose all devices.
Download the development profile and double click to install (in Xcode).
Double-clicking doesn't seem to do anything? How do I know it's installed in Xcode correctly?
Do I need the .mobileprovision file on my iPhone? The mac server is in the cloud so I don't have my iPhone connected via USB to the mac.
Open Xcode. Confirm my apple account added in Xcode > Preferences > Accounts. In the project, targets, signing, click "Automatically manage to sign".
Choose my personal team. The following errors are displayed:
Error 1: The app ID "NSP.BBH-Mobile" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.
Why does it prompt to change bundle id? Isn't it standard to have one app id and to generate both a debug/development and release?
Error 2: No profiles for 'NSP.BBH-Mobile' were found Xcode couldn't find any iOS App Development provisioning profiles matching 'NSP.BBH-Mobile'.
But we just created a new development provision and selected App ID = NSP.BBH-Mobile. Why doesn't Xcode recognize this?

you may try unselect Automatically manage signing and import provisioning profile manually.

These are the steps I took to finally resolve this issue. It may not be optimal but it at least worked.
1. In Xcode, turn off automatically manage signing.
2. For signing (debug), select my development provision profile.
3. For signing (release), create a production provision profile, then select the new production profile.
Notes/Observations:
Even though I only wanted to create a signed debug for testing it seems I still had to provide valid signed release provision too.
Even after deleting all keys/certificates etc. and starting from scratch it seems Xcode has created a certificate too. Annoying - it's difficult to tell who created what now.
There was no need to change the bundle ID from the original iOS native app being replaced.
Creating a new production provision did not affect the existing production provision (which I could not use because I don't have the key).

Related

Xcode 11 Archiving to Generic iOS Device errors relating to registering bundle identifier and iOS App Dev provisional profiles matching my app id

As the title says, I'm on Xcode 11 and trying to archive to a generic iOS device to add a new version of the app to TestFlight. It builds fine on all simulators. I don't believe I can change the bundle identifier as I'm adding an update to an app that's already on TestFlight. See below for archive errors.
Errors:
"Failed to register bundle identifier. The app identifier "com.'myappnameishere'" cannot be registered to your development team because it is not available. Change your bundle identifier to a unique string and try again."
No profiles for 'com.myappnameishere' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.myappnameishere'
What I've done:
A. Gotten an Apple Developer Account and registered my devices
B. Cleared the local Provisional Profiles using this method:
Xcode Error: "The app ID cannot be registered to your development team."
Apologies if this has already been posted but I couldn't find anything. Any help would be appreciated!
If the app is already on TestFlight, you cannot just use any apple developer id, you need to be logged in with the same apple dev account which was used to upload the app to TestFlight before
To archive, and upload an update to the app, you will also need the following installed in your machine
app store provisioning profile for the bundle id
certificate assigned to the app store profile
private key for the certificate's
(or you need to create these artefacts, and install / download them on your machine)
It is not clear if you already meet these criteria.
EDIT: answers to questions in your comment -
You may also face issues running the app on the device if you do not have developer profile for the bundle id, but with free provisioning / wildcard profile, you can circumvent this, and not need access to the specific dev account.
You can create and export archive (generate ipa file) ready for testflight using those artefacts, but to upload the ipa to testflight using any method, you will need credentials for the specific dev account. Alternatively, you can generate the ipa and share it with someone who has access and can upload the ipa.

Your account already has a valid iOS Distribution certificate - Xcode error msg with signing app

When I try to use the 'Export > Save for Ad Hoc Deployment' option in Xcode I am presented with a dropdown menu where it says the following :
To Save for Ad Hoc Deployment, select a Development Team to use for provisioning:
I only have a single option so once I click 'Choose' I get the following error message:
Xcode attempted to locate or generate matching signing assets and failed to do so because of the following issues: Your account already has a valid iOS Distribution certificate
When logging into my iOS Developer account I can see I currently have 3 iOS Distribution Certificates (5 in total) and all currently valid (e.g they expire in the future).
The Mac I am using is new, plus all the mobile iOS apps were developed by external developers/teams therefore I'm not sure which certificates I can safely remove.
As the certificates would have been made on other machines I don't have access to it isn't possible for me to simply export the existing developer profiles on these other Mac's and have them installed on my Mac. I'm also unsure if i can revoke current certificates? What is the worst that can happen when revoking current certificates?
As with most error messages in Xcode regarding certificates, it is not very helpful. I would do the following:
delete all the current certificates on your developer account
create new ones on your new machine MANUALLY (not through Xcode, so use the Keychain), this will make sure that the keys that sign your certificates are in your current keychain
update your provisioning profiles with the new certificates
sync the new profiles within Xcode (Preferences -> Accounts)
update your app settings
To this day I still manually do all my certificates and provisioning and while certainly not problem free, I don't seem to have nearly the nightmares that many people do. The only part of the process that I do let Xcode handle is to sync up the profiles.

Deploying iOS app for development on multiple devices

I'm working on developing an application for iPhone. I recently acquired a new development device, and would like to deploy the application to this device for testing, in addition to the device I have already been using.
When I try to deploy the application, I get an error saying that:
No matching provisioning profiles found: None of the valid provisioning profiles include the device "name of my device"
I have read the documentation on Apple's official developer portal, but it's unclear to me what I can re-use on this new device and what has to be created for it uniquely.
Can I use the same AppId? (I would hope so, since I can only have one app Id for a given Bundle ID)
I generated a new certificate request and named it something different. I also tried to add the new development device as a device allowed to use the provisioning profile I am already using in the application. Apparently, my code signing identity is still not found when trying to build on the new device. Any suggestions?
You have to add your new device identifier to the Provisioning Profile in the Development Portal. The process should be automated if you connect the device while Xcode is open, check out the Organizer for registration progress.
Delete old profile from xcode and download fresh copy of provisioning profile with new device identifier. Add this profile to xcode.
Go to Project -> Build settings-> Code Signing -> there select latest downloaded profile.
It will work

how to get .mobileprovision to build phonegap iphone app at windows?

I'm using windows 8 to building applications with phonegap,
every thing is good except building apple application at:
https://build.phonegap.com
this appears:
phonegap build "no key selected"
how to get the key or .mobileprovision file?
You have to create them on https://developer.apple.com/, as AJD mentioned.
Go to your Apple developer portal
Click Devices to register your iOS device. You need to connect your device to iTunes to obtain your UUID
Click Certificate
Create a certificate for Production (to use PhoneGap Build, otherwise Development)
Download the certificate
Convert the certificate to a p12 file (See the screenshots below) - Double-click the .cer file to open it in Key Chain Access. Then click My Certificates under the category, Ctrl-click the certificate and export. When you save the .p12 file, you are asked to create a password that you will need later.
Create a provision file on Apple developer portal, then download. Again, to make this work on PhoneGap Build, you need one for Distribution, otherwise Development.
Actually, I blogged about it because using PhoneGap Build is not as easy as it should to develop iOS apps.
http://www.pubnub.com/blog/converting-your-javascript-app-to-an-ios-app-w-phonegap/
I know this question is made a year ago, but I hope this helps to everybody who has the same question.
You create and download the provisioning profile and an associated certificate on the Apple developer site.
Go
https://developer.apple.com/
Go member center > manage certificates and profiles...
A valid provisioning profile is connected to a valid distribution certificate. You will need both active.
Building for iOS
We're now able to offer support for building to iOS devices through Adobe® PhoneGap™ Build. The process for completing iOS builds is slightly different than that for other platforms: all iOS builds need to be signed by a developer certificate and a provisioning profile, that is tied to your Apple developer account and the device you wish to test on. This document covers how to set this up.
Note: Since PhoneGap Build uses Apple's standard development process to build applications, you will need to sign up for their developer program to build iOS applications on PhoneGap Build. You will also need a Mac to configure your certificate and provisioning profile.
When you upload a new application to PhoneGap Build, if you don't have a default certificate-profile pair attached to your account, you will be alerted that the iOS build can not be completed:
iOS Key Required
Your key will actually consist of two files: a certificate and a provisioning profile. Apple has extensive documentation for setting up your environment locally: the best approach is to ensure you can build an iOS application to your iOS device locally, to be sure that both your certificate and your provisioning profile are set up correctly for code signing.
Once you have these set up, you can export them for upload to PhoneGap Build. For the provisioning profile, you will need a file with the mobileprovision extension, which looks like this:
Provisioning Profile in Finder
Ensure that this provisioning profile is correctly paired with the device(s) you wish to test on.
Note that when you create your profile, you will specify the App IDs that are linked to the profile. This is important when using PhoneGap Build: the package name you specify for your app, in your config.xml (the id attribute of the widget element) or through the Edit App page, will have to match the ID for the provisioning profile. If they fail to match, your app will not be built correctly.
Apple appends a "Bundle Seed ID," or "App ID Prefix," to the provisioning profile when you generate it through the iOS Developer Center. Note that you do not to include this App ID Prefix in your config.xml for PhoneGap Build to build successfully. You just need the reverse-domain style Bundle Identifier - com.domainname.appname. This will also be best compatible with building for other platforms.
To prepare your certificate, you will need to open the Keychain Access utility on your Mac, and identify the certificate that you use for iOS development. Right click on that certificate and select Export ...
Export from Keychain Access
Save the certificate in a location you can remember, and enter a password. Remember the password: you will need to give it to PhoneGap Build, otherwise we cannot use your certificate.
Enter Certificate Password
Now back to the website. On the app detail page, simply select the "new key..." option from the signing key dropdown for the app in question, and then, from the list of platforms with signing available, hit add a key for iOS. Fill out the form: add your p12 certificate file and your mobileprovision file, and enter the password associated with your certificate.
Add Certificate to PhoneGap Build
Once your key is added, we'll attempt to rebuild the application for iOS. If all goes well, you should see a link for the built ipa file available.
You can then download the ipa file and use iTunes to install it directly on your provisioned iOS device.
Happy building!

Need to force Xcode 5 to not use wildcard provisioning profile

I'm trying to use the new Automatic Configuration in Xcode 5 and it seems that when I run builds on my iPhone it is downloading the wildcard provisioning profile and using that to run the app. This is no good because my app uses push notifications and the wildcard will not have the correct entitlements to register for push notifications.
Is there a way to specify to use the provisioning profile for the qualified app id so I can test push notifications?
Strategies I have considered:
Delete wildcard app id - You cannot do this
Delete wildcard provisioning profile - Xcode will recreate the wildcard provisioning profile
Specify the provisioning profile explicitly in the target's build settings
I don't know how to determine the explicit name with Xcode 5. I could download and open the profile in a text editor, but that can't possibly be the right way to do this
If I specify the provisioning profile, I will need to update it every time a new profile is generated (add a new device, profile expires, signing certificate expires). This defeats the purpose of automatic configuration.
I've poked around Xcode looking for such a setting and haven't seen anything useful
I have followed the steps here (for configuring Push Notifications) and when I refresh my provisioning profiles they are not updated.
Any ideas?
Xcode was not downloading the provisioning profiles because it did not find any app id MATCHES. It did not find any matches because the capabilities in the "Certificates, Identifiers, Devices" website did not match the capabilities listed in the project in Xcode. Because the app identifier has In-App Purchase and Game Center enabled on the website but once I enabled it in the project it automatically downloaded the relevant provisioning profiles.
Hope this helps someone else.

Resources