Xcode Failed to load profile - ios

My Xcode suddenly got a weird issue that there's some provisioning profiles I couldn't download or even import them manually. Got an error message all the time.
I tried to uninstall and reinstall Xcode again, and still got the problem. Also, I manually copied the profile into ~Library/Mobile Device/Provisioning Profiles folder, and my Xcode wouldn't recognize it.
Have anyone seen the issue before? Please don't ask me to delete and re-create the profile as it's a company provisioning profile, and it worked on my colleagues' computer.
Just recognize I was able to load or install all distribution profiles, all development profiles got the issue.

Here are a few checks I go through when I get anomalous behavior from Xcode with respect to development provisioning profiles.
Check to ensure that you have selected the correct Apple ID and correct Team by clicking Xcode > Preferences > Accounts > select the correct Apple ID on the left-hand side of the panel, and select the correct Team at the lower-right hand side of the panel
Check to ensure that you have installed the necessary components for Xcode by clicking Xcode > Preferences > Components > ensure the correct Toolchain is selected, then > Check and Install Now
Download the provisioning profile manually from the Apple Developer Portal, then drag-and-drop it onto your Xcode dock icon.
Open your project in Xcode and click on the project icon in Project navigator > Build Settings > scroll down to Code Signing Identity > ensure is set to iOS Developer
While still in Build Settings, scroll down to Provisioning Profile > ensure the name of the profile you expect is selected or that it is set to Automatic
Try to build.
If that doesn't work, you can try altering step 4. by doing the following instead:
Make sure to not select "Automatic" for the "Provisioning Profile" field(s) in Xcode > Build Settings
Instead, set all "Provisioning Profile" fields specifically to the profile with which you are trying to build
open the Terminal app
cd to the directory of your Xcode project
cd into your Xcode project, like so: cd MyProject.xcodeproj/
cd xcuserdata
open project.pbxproj -a TextEdit
hold the "command" key and tap "F" on your keyboard
enter 'PROVISIONING_PROFILE' and press 'return'
if 1 or more results are found, ensure the value to the right of the PROVISIONING_PROFILE variable is set to the UUID of the profile you want (i.e. compare to what you see in Quick Look to ensure a match)... if 0 options are found, something else may be wrong with your xcodeproj file
the UUID should be a string (surrounded by double-quotes), e.g. PROVISIONING_PROFILE = "abcdef01-2345-6789-abcd-ef0123456789";
save the file with TextEdit and then close TextEdit
try to build again

For those who also got this issue, I was able to resolve this bug by deleting complete my XCode 9.4.1 and all local provisioning profiles, and update to latest XCode 10.0. After that, I can install and load all profiles as usual.

Kindly make sure installed mobileprovision file is valid, otherwise kindly regenerate the mobileprovision from developer.apple.com site and import it manually in xcodeproject IDE.

Related

Missing Provisioning Profile :Apps must contain a provisioning profile in a file named embedded.mobileprovision

App is already submitted to App Store from xcode-9 and now I have to update new version.But now xcode is updated i.e.xcode 10.During Validating it shows
'Apps must contain a provisioning profile in a file named embedded.mobileprovision..' .App is working fine on simulator
Even I have downloaded provisioning certificated.
I tried to clear out the provisioning profiles and none of it did help. What changed from the previous XCode version to this one is the build system. By changing your build system back to the legacy one, this was resolved for me.
You can switch out the build system under file > workspace settings (or project settings) and then select Legacy Build System under Build System (see screenshot).
Edit: As of cordovo iOS 5.0.0 the new build system is now supported. Changelog can be found over here: https://cordova.apache.org/announcements/2019/02/09/cordova-ios-release-5.0.0.html
If running/building from the CLI, use this command to use the legacy build system instead of the new one
cordova build ios --buildFlag="-UseModernBuildSystem=0"
You can also create a new build.json file at the root of your cordova project, if you don't already have one, and add the following json data. This basically tell the build process for "ios" to use the legacy build system. It will automatically add the build flags in the build.json file to your build command e.g. cordova build ios --prod will also run as though it was typed as cordova build ios --prod --buildFlag="-UseModernBuildSystem=0".
{
"ios": {
"debug": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
},
"release": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
}
}
}
Clean your build (Cmd + Shift + K). Quit XCode (don't just close the project, make sure XCode has completely quit).
Delete everything in the ~/Library/MobileDevice/Provisioning Profiles folder.
Re-start XCode and load your project.
If you have XCode set to Automatically Manage Signing, you should be able to select your team and then it should re-download your provisioning profiles for you. If you don't, you'll have to manually download them from your Apple Developer account and then select "import" from the Debug signing dropdown and the Distribution signing dropdown.
If you then try to run the app on a device and you get a "Valid Provisioning Profile cannot be found for this executable" you need to go to Window | Devices & Simulators. Find your device on the left side of the window, ctrl+click on it, select "See Provisioning Profiles". Click on each individual profile and click the minus sign at the bottom. When the list is empty, click on the plus sign to add a new one, then find the profiles you downloaded and import each of them, one at a time to that list.
That should hopefully fix any provisioning profile issues that XCode is giving you.
Good luck!
If you have the above problem and it is being solved by switching to legacy build system. The alternative with new (default) build system is to to manual signing.
When uploading or validating your archive pick 'manual' option and select your Team and download the provisioning profile. (Or import after a download from the developer portal).
I created a new provisioning profile and selected "Manually Manage Signing" and selected the profile I had manually created.
It then complained about missing a 1024x1024 icon which I fixed with this answer: Missing App Store Icon. iOS Apps must include a 1024x1024px App Store > Icon in PNG format

Xcode has conflicting provisioning settings

I have an Ionic 2 app, which builds and is testable in Xcode 8.2.1 Simulator environment, e.g. iPhone7 (Build Successful).
When I try Archive the app to create an ipa file to set on a device, I follow these instructions. But Product -> Archive is greyed out. So I change the active scheme to Generic iOS Device.
But then when I click Product -> Archive, I get Build Failed.
theWhoZoo has conflicting provisioning settings. theWhoZoo is
automatically signed for development, but a conflicting code signing
identity iPhone Distribution has been manually specified. Set the code
signing identity value to "iPhone Developer" in the build settings
editor, or switch to manual signing in the project editor. Code
signing is required for product type 'Application' in SDK 'iOS 10.2'
If anyone could advise how I can fix this to build an Archive, I would appreciate it.
This worked perfectly for me. Give a try :)
Step 1:
Select the Project Target-- > Build Settings. Search PROVISIONING_PROFILE and delete whatever nonsense is there.
Step 2:
Uncheck "Automatically manage signing", then check it again and reselect the Team. Xcode then fix whatever was causing the issue on its own.
The problem is in Code Signing Identity. This is a new problem that showed up on the latest release of Xcode. Go to Code Signing Identity, then add other and type in "iPhone Developer" as shown in the error message and save then this will display.
If this does not work show me your General signing. and your Code Signing Identity from both your Project and your Targets
The problem is in Code Signing Identity. This is a new problem that showed up on the latest release of Xcode. Go to Code Signing Identity, make all IOS Developer rather that IOS distribution.
UPDATE Just figured out the real issue [assuming that your app has the correct provisioning profiles, but a target for your app does not]: Navigate to your target and change the provisioning profile there. See below:
I got this error when I added a target to enable rich push notifications. The project/workspace, "Spontit" did not have this error but the target "RichNotification" did.
I tried several things, and the last thing I did, that seemed to be responsible for it finally working, was:
Un-add and re-add the embedded binary for the target "RichNotification" in the "General" tab of the project, "Spontit".
Another thing to check is to make sure that it is added as a "Target Dependency" in the "Build Phases" tab.
For this particular problem, make sure to clean your project (Cmd Shift K) before building it, every time. Otherwise, you might fix it and try to build it and think it's not working, but really it's using the old settings- so clean it first.
For me Only this worked.I tried changing the Provisioning Profile(Deprecated) Value to Automatic.
This worked for me and I hope it would be helpful
for someone.
Project Target -> Build Settings -> Code Signing Identity -> Change the Debug and Release to iOS Developer and iOS Distribution.
If you have error message like this:
[target name] is automatically signed, but provisioning profile xxxxx-xxxx-xxxx-xxx-xxx has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor, or switch to manual signing in the project editor.
You can fix like this:
1. Check Automatically code sign in
2. Uncheck Automatically code sign in, then check it again and reselect the Team. Xcode then fixed whatever was causing the issue on its own
3. If still not work, find project.pbxproj, search the profile, and just delete that line, then save it.
This work for me!
Close Xcode project.
Using finder go to project folder.
Right click on .xcodeproj and choose "Show Package Contents"
Right click on project.pbxproj go on "Open With" and choose TextEdit
Now search for your Provision Profile instanceId specified in the error message.
Delete all found texts and let Provisioning Profiles clean.
Save & Close.
Open Xcode
Enable automatically manage signing
Source: https://www.codegrepper.com/code-examples/whatever/has+conflicting+provisioning+settings+xcode
I tried multiple things mentioned in stack but nothing worked except above solution.
HERE IS THE FIX
FOLLOW THESE STEPS:
open your project in xcode, in my case I used xcode 9.
INSIDE THE GENERAL TAB DO THE FOLLOWING
UNCHECK THE FOLLOWING OPTION:
Automatically manage signing
THEN SIGN YOUR DEBUG PROFILE
provisioning profile should be your development profile from the dropdown
Team : will be populated because of the above provisioning profile
Sigining Certificate: will be populated.
THEN SIGN YOUR RELEASE PROFILE
provisioning profile should be your release profile from the dropdown
Team : will be populated because of the above provisioning profile
Sigining Certificate: will be populated.
That is all, clean and archive your project.

The application does not have a valid signature Xcode 7.3

When I run my project in simulator it works fine. But run the project in real device always gave me a app installation failed message which is:
'The application does not have a valid signature'
I have valid developer certificate, provisioning profile. I cleaned my project, removed Derived Data but nothing solved my problem yet. screenshot what I got
Go to your project build settings, look for section "Code Signing":
Make sure your (correct and valid) developer certificate is selected under "Code Signing
Identity"
Make sure "Provisioning Profile" is set to "Automatic"
See screenshot:
If still not working:
Open keychain app
Look for your developer certificate and make sure it is valid and has
no duplicates (if there are duplicates, delete and leave one valid
certificate only)
Open Xcode and go to preferences
Select "Accounts" tab
Select your Apple ID user
Double click on your team (in the bottom right side of the window)
Right click on any provision profile (bottom list)
Select "Show in finder"
Delete all files in that folder
Go back to Xcode window, and click on "Download All"
Press "Done"
Try to re-build project
If still not working, let me know.
I was with the same problem.
I installed the last update of OS X and my problem was fixed!
I hope that it can help you!

Add mobileprovision file to Xcode

I know this is simple, but I've read through all the questions and there doesn't seem to be a simple answer to this.
I've created an appID. I've created a mobileprovision file, downloaded it and double clicked it and that all seems fine.
How do I get this profile though to show up in XCode? and where would it show up?
using latest version of iOS and XCode.
It's appearing, evidently it just takes time to appear.
Open Organizer in Xcode (Window -> Organizer), go to the Devices tab and select Provisioning Profiles in the left drawer. Then use the Refresh button on the bottom right.
Update 2018
From #mikeLspohn comment: Go to Window > Devices then right-click on your device and select Show Provisioning Profiles ... from there you can click on +/- to add or remove profiles -
Two steps:
First drag it onto iTunes. Dropping a .mobileProvision onto iTunes will install it in ~/Library/MobileDevice/Provisioning Profiles where it is supposed to go.
Second double-click on .mobileProvision to add it to the Xcode store.
It doesn't hurt to relaunch Xcode after that.
You can always just drag the file onto the Xcode dock icon. This will add it to Xcode's store. When your target has the correct bundle ID and you have the private key, you should be able to select the appropriate profile and signing identity in the Code Signing build settings.
In XCode 12.2, click Window in the menu > Devices and Simulators
Right click you device, and select Show Provisioning Profiles...
Then click "+" to add your .mobileprovision files.
UPDATE:
The method above added mobileprovision files and shows in Xcode UI. However, it does not add to
/Users/myusername/Library/MobileDevice/Provisioning Profiles
And when I build from Xcode, it still says the mobileprovision files are missing.
And the end, I found I only need to double click each mobileprovision file to add them under the folder of
/Users/myusername/Library/MobileDevice/Provisioning Profiles
And my Xcode has no issue building this time.
Xcode 12.3
Select your project in the navigator
Select your target
Select Signing and Capabilities
Uncheck the Automatically Manage Signing Box
You will then see a dropdown to select a provisioning profile. You can 'download' directly from Apple, assuming you've set up the profile on the developer site. Or you can 'Import' a file you've downloaded separately.
Now, check the Automatic Signing box again.
I am not sure if this is necessary, but as Hongbo Miao has pointed out, you can download the file and double click it to 'add it to the library'.
Go to http://developer.apple.com in Safari on your device and navigate to the SDK/downloads section. From that page, download the .mobileconfig file and when prompted, Install. This will allow you to install beta builds when you go to Settings -> General -> Software Update.

Codesign error: Provisioning profile cannot be found after deleting expired profile

Tried to rebuild an app that was working just yesterday. Got a message that a profile had expired, so I removed it from the iPod and from iTunes. When I chose a new profile (one with an * in the identifier), I now get an error:
Code Sign Error: Provisioning Profile (long string) can't be found.
What am I missing? I looked through related questions and didn't see this scenario already.
Sometimes your Xcode project file gets messed up, especially if you have an old project and first created it with an older version of Xcode/iPhone SDK.
What you need to do is open up the project file in a text editor, search for the 'long string' from your error and manually erase that line.
In fact, you should just go ahead and erase any line that points to any provisioning profiles. Then reopen the project in Xcode, go to the settings and reselect your new profile. This clears up issues like that most of the time.
The lines that point to the provisioning profiles will look like this:
PROVISIONING_PROFILE = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
Here's a simpler solution that worked for me and which doesn't require the manual editing of the project file:
In Xcode, in the "Groups & Files" pane, expand "Targets" and double-click on your app's target. This brings up the Info pane for the target. In the "Build" section, check the "code signing" section for any old profiles and replace with the correct one.
Note that this is different from double-clicking on your project icon and changing the profile from there. Quite amazing :)
Ori
Project&Targets Properties -> "Don't Code Sign" -> OK -> cmd+S(or cmd+B);
Project&Targets Properties -> "Your Provision Profile"-> OK
Everything works again!
I agree with Brad's answer, that you can fix this problem by editing your target/project by hand, deleting any lines like this:
PROVISIONING_PROFILE = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
However, in Xcode 4.2 and later, there is a much easier way to access this text and select and delete it. In the Project Navigator on the left, select your project (the topmost line of the Project Navigator). Now simply choose View > Version Editor > Show Version Editor. This displays your project as text, and you can search for PROVISIONING and delete the troublesome line, right there in the editor pane of Xcode.
Just saw a variation on this issue: I went into the project.pbxproj file as per Brad Smith's notes above, except in this case all of the PROVISIONING_PROFILE lines seemed to be correct, with no occurrence of the "bad" profile string that Xcode couldn't find.
However, the fix was the same: deleting ALL of the PROVISIONING_PROFILE lines in project.pbxproj, even though they looked "good" in theory, and then reopening the project in Xcode.
To achieve Brad's solution entirely in Terminal, use these commands
cd [Xcode project parent]
vi [Xcode project name].xcodeproj/project.pbxproj
/[offending provisioning profile] [Enter]
dd - delete the entire line
Press n until no more are found
Ctrl+x to save and close
In my case the problem was solved by opening Window -> Organizer, selecting my device and removing the old Provisioning Profile under the "Provisioning" panel on the right. The old one was already marked with a red "x" symbol but the iPhone was still using it.
Besides that profile, also the new one was showing up (with the same name) and after simply relaunching the application I had it running smoothly.
Just spent a hour or so doing this and with the help of Brad's advice and a few additional changes it all worked.
I've done this using the following: 10.7.3, Xcode 4.3.2, iOS 5.1 btw.
1) Right click on your myapp.xcodeproj and select package contents
2) open project.pbxproj with a text editor (don't recommend textedit as it may screw up the formatting)
3) Scroll all the way down until you find /* Begin XCBuildConfiguration section */
4) Notice that you have a debug and release sections
5) In the release section take a look at CODE_SIGN_IDENTITY & "CODE_SIGN_IDENTITY[sdk=iphoneos*]" it should look something like this:
CODE_SIGN_IDENTITY = "iPhone Distribution: MyCompany LLC";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: MyCompany LLC";
6) Take a look at PROVISIONING_PROFILE and "PROVISIONING_PROFILE[sdk=iphoneos*]" they should look like this:
PROVISIONING_PROFILE = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
This should match your provisioning profile in Xcode. To see if they match open Xcode > Window > Organizer > Devices > Provisioning Profiles > Right click on the profile > Reveal in Finder > The filename of the .mobileprovision is your profile id.
7) Scroll down in the project.pbxproj and find a second instance of the release section. The second instance of the release section should end with a comment saying /* End XCBuildConfiguration section */
8) make sure that the second section matches the first section so that CODE_SIGN_IDENTITY, "CODE_SIGN_IDENTITY[sdk=iphoneos*], and PROVISIONING_PROFILE are all filled in.
One suggestion I'll make since no one yet has said it: PLEASE PLEASE PLEASE make a backup of your whole .xcodeproj file BEFORE you start modifying it's contents. Screwing up the project file and having no backup will lead to a very very unpleasant experience.
Being able to back out of an edit can be a godsend.
Select the lines in codesigning that are blank under Any iOS SDK and select the right certificate.
The solution of Brad Smith worked for me, but I also had to remove the CODE_SIGN_IDENTITY field to make it work.
I just encountered this problem in my Xcode 4. To fix it,
you need to put all the correct provisions into both Debug and Release config.
I was trying to submit (by archiving) my app. So I just change the Debug provisions to "Don't Code Sign", and the Release provision to my app's appstore provision.
This fix it and enables me to archive normally. Hope that helps.
Unfortunately this approach didn't work out for me. But here's a fix which worked for me (to get this to work you need a working project file on Subversion or so):
I did roll back to an working version of my project file. As it isn't possible to revert with Xcode (Where is the 'Revert' option in Xcode 4's Source Control?) - I used Tortoise, my Windows machine and this Tutorial (http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-howto-rollback.html) to roll back to an older project file.
As the Tutorial didn't work out for me, I just used Tortoise to save the working revision of my project file to an usb stick to port it to my mac. After that I replaced the new broken project file with the old working one, cleaned and it worked like a charm!
At least in Xcode 5, this is the thing that solved the problem for me:
Under provisioning profile, select the offending provisioning profile and then select a valid provisioning profile in the pull-down menu.
You Could remove old reference of provisioning file. Then after import new provisioning Profile and selecting Xcode builder.
I was having issues because I updated my AdHoc provisioning profile with some new devices for use on TestFlight. Assumedly this is happening because Xcode has an old reference to your provisioning profile in either the codesigning build settings for the project or the targets. The way I fixed mine was to:
Go to both target build settings and project build settings, Under code signing change all the provisioning profiles to something else.
Go to devices/provisioning profiles in the Organizer delete the offending profiles, then click the refresh button in the bottom right.
Go back to to the target and project build settings and set your provisioning profiles to the appropriate (hopefully) newly refreshed provisioning profiles.

Resources