xcode build to iphone chooses old invalid provisioning profile - xcode

I've just gone through some pain with iphone and xcode upgrades and keychain failures etc and decided to uninstall xcode completely and re-install. This fixed my keychain issues however the project I am working on appears to be linked to an old invalid provisioning profile.
I've deleted the profile from "Provisioning Profiles" in organiser, and removed it from Provisioning on the Iphone section of Organiser. However when I build an go with the iphone sdk rather than simulator i get the pop up "codesign wants to sign using key "OldKey" in your keychain".
It appears the actual app is associated with the old key and I can't seem to find how to point it to the new valid one.
Crazy thing is at some point I managed to get it to work and install but the application crashed and won't open. I've not managed to get it to install again.
Any ideas?

I ran into a similar problem. To fix:
1) In organizer, delete the profile from the phone.
2) Also in organizer, delete the profile from the Provisioning Profile list.
3) Finally, search your computer for provisioning profiles and delete the old ones directly.
After that, drag in the new profile and it will work.

This caused me all manner of problems! Open the app.xcodeproj package and drag & drop the project.pbxproj file into text-edit. Do a search for "PROVISIONING_PROFILE" and delete the profile ID. restart xcode and build, hopefully it should pick up the new provisioning profile and forget about the old one that was causing you issues.
Note: Be sure to do a backup of the project.pbxproj file before editing it.

xCode 4 -reinstalls keychain certs that I delete

Related

Xcode 8: Your account does not have sufficient permissions to modify containers

I'm getting this error with code signing with Xcode 8:
Your account does not have sufficient permissions to modify containers
What does it want from me?
I also faced this issue in XCode 8.3.3 (8E3004b). I just went to Project Settings → Capabilities tab, then toggled iCloud off and on. Once I went back to the General tab, the errors were gone.
This seems like it may be a bug with XCode 8.
To resolve this, I unchecked the "automatically manage signing" checkbox in the of my target's General settings. I then archived my project by manually setting the provisioning profiles. After that succeeded, I went back and again checked the "automatically manage signing" checkbox and it stopped complaining with errors that made no sense.
Just had this issue with XCode 8.3.2 after we enabled iCloud Capabilities and the entitlements changed. We use automatic signing - xcode managed profile. Going into Xcode -> Preferences -> Download All Profiles wouldn't fix the problem UNTIL we temporarily made team members Admin and repeated the process. At that point XCode realized the new provisioning profile and the problem was solved.
Just goto Xcode capabilities section and see if any of the capability showing error then disable that and enable again. Then come to your Signing section in General. The issues will go now
1) Remove all automatically created provision profiles from
~/Library/MobileDevice/Provisioning Profiles/
2) In Xcode 11.1 and higher remove and add capabilities
I faced this issue in XCODE Version 8.3.3 (8E3004b). To resolve this go to project settings. In capabilities tab -> iCloud -> containers. Verify whether valid iCloud containers are selected and you have permission to access these containers. This should resolve the issue.
I was having the same problem too after I added a new device with Xcode 8.3.3 (same issue present in Xcode beta 9.0 as well). My Apple Developer account wasn't an administrator at the time either. I tried deleting my provisioning profiles and re-downloading them but that didn't work. I tried manually downloading and installing the provisioning profiles from developer.apple.com, but that didn't work either. I had my Apple Developer account made an Administrator following advice from dchappelle https://stackoverflow.com/a/43812123/5760384 and voila! The provisioning errors went away. (I'd reply to his post, but I don't have enough reputation.)
Full text of error:
Your account does not have sufficient permissions to modify
containers. Provisioning profile "myApp" doesn't include the currently
selected device "myDevice". Code signing is required for product type
'Application' in SDK 10.3
Another potential solution, depending on your needs, is to upgrade to the paid version of the Apple Developer Program; this gives you access to the iCloud container features. Once paid and activated (the membership application takes a few hours to go through if you're an individual... sometimes a few days if you're a business) you'll need to enable iCloud features via the online dashboard or via XCode as per Apple's instructions. You may then have to restart XCode.
I had the same issue with Xcode 9.2. But in my case, the problem was in Keychain: my dev certificate was saved into login keychain by default. I was able to build an app on a device only when I moved it to System keychain.
So the steps are next:
Open Keychain Access
Open login keychain (you can see the list of all keychains on the left top corner of the window)
Drag and drop your dev/distribution certificate into System keychain
You may need to input password.
PS: while doing this steps you also may need to unlock locks on the keychains.
I had this problem and I fixed it by logging in to the iTunes development portal and accepted the new Terms & Conditions. I was basically locked out until these were accepted.
I was getting this error because I was in another team (my university team account), which was severely limiting my access to developer.apple.com features. Once I left that team (I added an answers here because even this was a bit of a pain), I was able to remove & re-add my account to XCode. It then worked.
EDIT: It happened again on a new machine (an M1 mac), and this time I had left the university account. By removing and adding back "Apple Pay" capability in Signing & Capabilities, it immediately fixed itself.
None of the other answers worked for me. E.g. The app doesn't even use iCloud, and enabling-disabling it didn't help. Deleting profiles, revoking certificates, disabling/re-enabling automatically manage signing also didn't help.
Go to Xcode -> preferences -> Accounts.
Remove your Apple ID & login back. Refresh the signing in on your project target
I had the same issue using Xcode 9.3
Solution:
1 - Deselect "Automatic manage signing"
2 - Created a Provisioning profile for dev and dist and added in Keychain.
3 - Again when you come back to Sighing (debug and release) you can see your created provisioning profile in a dropdown
4 - Crate archive by selecting "Generic iOS devices" in the project schema

How do I regenerate Xcode managed provisioning profiles?

I see a bunch of "Invalid (Managed by Xcode)" development provisioning profiles in the Apple Developer Center.
How do I regenerate them so they become green? (i.e. "Active (Managed by Xcode)")
When I try tapping on an active one, I have the following options:
Delete
Download
When I try tapping on an invalid one, I have the following options:
Delete
I don't know exactly what forces a refresh, but in the past, these things seemed to help:
Deleting all provisioning profiles in Xcode and pressing the Download All button regenerated the profiles (e.g. As a member, I pressed the Create button to create the development certificate, then pressing the Download All button added the newly created certificate to the managed profile.)
Adding a new device via the online portal seemed to regenerate the managed profiles to include the newly added device.
Pressing the Fix Issue button in Xcode in the target settings.
Try building to device and press the Fix Issue button when Xcode presents that option.
Sometimes you'll get in a state where everything gets regenerated except for the one with the app id you really need. The provisioning profile doesn't show up in Xcode, and no matter what you do, it stays stuck in the invalid state.
WARNING: The following may be very hard to undo, so do so at your own risk!
In that case, you could try deleting the provisioning profile on the Apple Developer Center and hope that the Fix Issue button in Xcode will regenerate it. I've seen it work before, but in some cases, I've seen it give this error with no means of recovery:
An App ID with Identifier 'com.example' is not available. Please enter a different string.
This may seem like you're in an even more unrecoverable situation, but I was able to regenerate it at least once by launching Xcode Beta 8 and tapping the Fix Issue button. It seems that they fixed some bugs with the Fix Issue button in the latest Xcode.
(Note: Sure you could try to delete the offending App ID and then press the Fix Issue button, but you'll invalidate all the important provisioning profiles on your account.)
If you still run in to issues, make sure that you're following these best practices.
If you run into code signing issues:
Make sure the development certificate has been downloaded.
Delete all invalid certificates from KeyChain.
Delete all provisioning profiles from your machine.
Download All the latest profiles.

Xcode 6 OS X Submission Error: iOS Apps must have a provisioning profile

I'm having the worst time ever submitting an update to my Mac app. Everything was fine until I updated to Xcode 6. I'm in Mavericks, 10.9.4. I get the following error:
iTunes Store operation failed.
Unable to process application at this time due to the following error: iOS Apps must have a provisioning profile.
I have no idea why it says "iOS." Don't know if that's an Xcode bug or it thinks I'm making an iOS app. I used the same Xcode project file to submit the Mac app in the previous Xcode.
I have tried the following with no results:
• Revoked and deleted all certificates and provisioning profiles and started over.
• I created all certificates, provisioning profiles manually rather than Xcode managing them.
• Set the provisioning profile in "release" in the target and in a different occasion, in the project file.
• Gone into the project info and created a separate configuration.
The only "weird" thing I would say that I could be doing insanely obviously wrong is when I look at the options for code singing identity for release, it says "Mac Developer:yata" but there is no option for "Mac Distribution:(myname)" Should there be? I didn't need that in the past. Also, the only options that I can select are in a section called "identities in keychain." Should there be another section? "Identities in Xcode?"
Thank you for anyone that can help. I'll try pretty much anything at this point.
Solution for my case:
I got error in validation stage.
On organizer we see:
1) Go to Apple download page and download xCode 5.1.1
2) Double click on xcode_5.1.1.dmg
3) Copy xCode.app to Desktop
4) Rename xCode.app -> xCode511.app
5) Move xCode511.app -> Applications
6) Close xCode 6.1
7) Work with validation and upload in xCode511.app
UPDATED
8) Be careful ! ITC.apps.validation.prerelease_build_missing
I don't have Xcode right now, but here are the steps:
Delete your certificate and provisioning, both your mac and iTunes account
Regenerate the certificates and provisioning profile (distribution)
Download double click
Go to the account tab, then view account
All certificates and profiles will be listed refresh the stuff there
Clean and rebuild your app with the right provision and 3 party Mac developer
archive, validate and submit (select the right provison and match the app)
voila!
EDIT
Everything you will ever need to know :
https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/Introduction/Introduction.html
I was having the same problem... finally I click on Submit and it worked! It seems that the problem is on Validate only.
Okay so our problem was that our company name had an apostrophe in it ---- could have the same issue if you have quotes in your company name as well. I contacted Apple for them to change it and then uploading worked from Xcode 5.1.1.

Xcode 5 will not import provisioning profiles

So in Xcode 5 I go to Preferences > Accounts and I add a new Apple ID to the left hand column. Note the apple id and password must be correct otherwise they would not be accepted.
So now I click on this new apple id on the left, and then click on View Details on the right and the Provisioning Profiles section is empty. I then click on the little round refresh/import button and it spins for 5 or 10 seconds and then returns to an arrow and no provisioning profiles have been added.
If I log into the Apple Provisioning Portal, there are 16 provisioning profiles sitting there waiting to be used, all of which were created with a CSR generated from my computer which I am trying to import them on.
Anybody have any ideas why it would not be downloading these profiles?
EDIT: Also note that I have three other developer accounts that I work with in my Xcode and they import fine. It is only the 1 of 4 that does not work.
New Answer (solved)...
Okay so I finally figured out what the problem was. In the Apple Provisioning Portal, the account that would not import, did not have any devices added. Once I added a device, then the import/refresh in Xcode 5 started working for this account.
Although I had to click refresh button twice in Xcode as the first click seemed to create all the Team Provisioning Profiles in the portal and then the second click imported them all.
Edit: I realized that the problem occurs because Xcode now wants to manage your provisioning profiles for you. If you do not have any development profiles then Xcode will try to create it, but since there are no devices added, it cannot create the profile and therefore fails (without giving an error) and does not import anything either.
Workaround if import does not work (old answer before I solved it)
For lack of figuring out what the problem is with the one account, I did the following:
(1) Downloaded all the provisioning profiles from the provisioning portal to my desktop.
(2) Downloaded most recent version of the iPhone Configuration Utility from http://support.apple.com/downloads/#iphone%20configuration%20utility
(3) Ran iPhone Configuration Utility and dragged and dropped all the downloaded provisioning profiles into it.
(4) Ran Xcode again and the provisoning profiles were now available.
I had the same problem on a fresh Mavericks install with XCode 5.0.1.
It appears to have fixed itself. I'm not sure exactly what solved it, but I was fortunate enough to have Xcode4 on an old OS X 10.8 partition, so I launched that from within Mavericks and I'm pretty sure that succeeded in downloaded all the provisioning profiles when Xcode 5 couldn't. I opened them in Finder and double-clicked on the one I was interested in.
You may want to check ~/Library/MobileDevice/Provisioning Profiles in case they are there but Xcode is ignoring them. Otherwise, you may have to download them (or maybe just one) from the Apple dev portal and try double-clicking on it to kick Xcode into action.
Hope that helps someone.

Provisioning Profiles menu item missing from Xcode 5

After spending a whole day installing a fresh copy of Mac OS X v10.8 (Mountain Lion), Xcode 5, fixing provisioning profiles, certificates, creating new ones, I finally managed to get my applications running on my iPad again. The problem is that in Xcode 5 I don't have a menu item for Library - Provisioning Profiles, and I don't know what could have happened. I restarted the computer, tried some things, but I really have no idea what I could do. How can I fix this problem?
These settings have now moved to Preferences > Accounts:
If you like to manually manage your profiles (mostly to clean up):
Open Windows/Devices in Xcode 6
Select your device
Show Provisioning Profiles:
You'll get + and - buttons to add/remove profiles:
No longer supported ... you can also download Apple's iPhone Configuration Utility 3.5 for Mac OS X, it still has "Provisioning Profiles" and works with Xcode 5 -- it's now gone from Apples site but you can find an alternative download link in #suda's comment.
Provisioning files are located in:
/Users/${USER}/Library/MobileDevice/Provisioning Profiles/
Just remove the out-of-date files.
Xcode 5 lost my Mac Provisioning Profile while the one for iOS was present. The tips elsewhere helped solve the problem; this is what I did, because I noticed the lists were too short and did not include *Mac Team Provisioning Profile: **
Xcode menu => Preferences => Accounts
Select the Apple ID in the left panel.
Click the View Details button on the right.
In the pop-over that follows click the round refresh arrow. The lists will refresh after the download from the Member Center finishes. This can take a few minutes.
The provisioning profiles can then be selected in a Mac project under Build Settings => Code Signing => Provisioning Profile.
Try this:
Xcode >> Preferences >> Accounts
You can add account in the preference -> Accounts setting.
It seems that you already configure xCode4, then I think you can select your
certificates for compiling in project-> Building Setting directly since your
certificates are already in your keychain.
After searching a few times in google, i found one software for provisioning profiles.
Install this iPhone configuration utility software and manage your all provisioning profiles in MAC.
Stupid as it may sound but all "Provisioning Profiles" re-appear under "Organizer - Devices" once you connect a real device.
For me, the refresh in xcode 5 prefs->accounts was doing nothing. At one point it showed me three profiles so I thought I was one refresh away, but after the next refresh it went back to just one profile, so I abandoned this method.
If anyone gets this far and is still struggling, here's what I did:
Close xcode 5
Open xcode 4.6.2
Go to Window->Organizer->Provisioning Profiles
Press Refresh arrow on bottom right
When I did this, everything synced up perfectly. It even told me what it was downloading each step of the way like good software does. After the sync completed, I closed xcode 4.6.2, re-opened xcode 5 and went to preferences->accounts and voila, all of my profiles are now available in xocde 5.

Resources