Code Sign error: Provisioning profile can't be found - iphone

I have been working the whole day to try to build my app on my device.
I get this error when I try to build on my device.
I have been reading about this problem but do not really understand how to fix it. The following is where I would believe the problem is. I am new on this so I have no experience how to solve this.
When I open the "Dont Code sign" I have "Automatic profile selector (recommended)" with two lines I can select and also "My profile for dev" with one line to select. Do not know if this is where the problem is?
Any help is appreciated.

Here's how I did it.
Shut down Xcode.
Back up the project.pbxproj file.
Edit the project.pbxproj file and remove lines of instances where it mentions the old provisioning profile.
eg. Delete line:
PROVISIONING_PROFILE = "8D024EDA-DC05-40DF-B3EB-536392615EE2";
Restart Xcode and perform a full clean of the project.
It should then build without warnings.
Enjoy!

In my case it was because the xcode 4.0.2 prevented deletion of stale data in the project.pbxpro in the *.xcodepro directory. I ended up hand editing the file after shutting down xcode. In the file I looked for all of the occurrences of "PROVISIONING", something like this:
PRODUCT_NAME = Xyzzy;
PROVISIONING_PROFILE = "CF5F0AEA-92D9-48E1-99DF-301AB36C2BFB";
"PROVISIONING_PROFILE[sdk=*]" = "CF5F0AEA-92D9-48E1-99DF-301AB36C2BFB";
SDKROOT = iphoneos;
and changed it to:
PRODUCT_NAME = Xyzzy;
"PROVISIONING_PROFILE[sdk=*]" = "";
SDKROOT = iphoneos;
I restarted xcode and the build succeeded with out issue. A word of caution make sure that you back up the project directory before make changes to the project files, and only hand edit the files when you have no other options.

I went and changed code signing identity the on project and target to "Don't Code Sign" and then changed back to the correct code signing identity. That fixed it for me.

what exactly is the error message?
Did you add your device including the required provisioning profile in the organizer? What do you see in the organizer when selecting your iPhone under devices? It should be there with the correct valid profile...

If you are working with a project created by someone else as a template, you need to change the code signing identity
screenshot: http://i.stack.imgur.com/UIpGS.png (Xcode 4.2)
ps. OSX would not let me edit the .pbxproj file with a text editor

I had this problem when I had to reissue development provisioning profiles with new names/ids.
The solution was to update all references in Edit Project Settings | Build (Code Sign) referring to Code Sign Developer (name). (Not Edit Active Executable.)
Click on the item(s) and check that the new profile is explicitly selected, and rebuild and run.
I suspect that the reason you get this error in the first place depends on whether or not you have set xCode up to try to resolve these dependencies automatically. In one of my builds replacing the profile was seamless - in the other I had to manually update it. Clearly the best solution would be a seamless one.

I've had this before, and it just worked by restarting Xcode. Probably won't work for you but I'll throw it out there anyway.

I had same error where the very previous build built just fine. I noted that my Build Settings -> Code Signing -> Provisioning Profile had been reset to strange one. All I had do is to point it to correct one to resolve the issue.

This one can be fixed by changing the project settings AND clicking Project > Edit Active Executable > Build and changing the settings there.

I just redid my provisioning profile and re-added devices to the portal in Organizer. Then I clicked my project icon, entered Build Settings, Code Signing and remapped to the new provisioning profile.

I had the provisioning profile set to one thing in Projects and another in Targets. Do a search in your project for the file that is missing and see if it pops up. No hand editing needed!

Like #Jonathan, I just restarted Xcode and it worked after it automatically retrieved the profile from my Apple developer account. This was Xcode 6.2

Related

Save for Enterprise or ad-hoc deployment not present

I am trying to build an IPA file for my app in view of some ad-hoc enterprise distribution. I have been looking at how to do this with Xcode 4.3.2, the version I am using at present, and I reached the point where in the organiser I should select the 'Save for Enterprise or ad-hoc deployment' option. The problem is that this option does not actually appear in the first place. In fact, I only have the 'Save Built Products' and 'export as Xcode archive' options.
I would imagine the issue lies in some configuration settings for my app, but have been unable to find any help over the web. Hence my question here :-)
Would appreciate some help in understanding what is wrong with my code.
Thanks in advance to anyone helping here.
Cheers.
If your project uses a third-party lib as a sub-project, there are a couple of settings that you may need to change so that xcode will recognize your app as a single–bundle rather than multiple products. Only single-bundle apps can be saved for enterprise or ad-hoc deployment, or submitted to the app store.
First, in the Build Settings tab of the third-party lib target, set the Skip Install setting to Yes.
Second, in the Build Phases tab of the third-party lib target, look in the Copy Headers phase and ensure that there are no headers in the Public or Private section (they should all be in the Project section).
I finally got around this. It turned out the issue was that I was using third-party libs by including their (source) Xcode project rather than as pre-compiled libs. For some reason Xcode sees them as distinct apps, and won't let me wrap all of them under one single IPA.
I removed the project, dropped the actual static libs and headers, produced the archive and...tadaaah: here I could sy my most wanted export option.
Thanks everyone for the help, a special thanks to The Saad who helped me finding out this.
well, I met the same problem when I was using GMGridView. I didn't use Diferdin's solution since I still want to keep the GMGridView project there.
My solution is: Go to GMGridView's target, click "Build Phases" -> "Copy Headers", then move all header files under "Public" and "Private" to "Project".
Redo the Product -> Archive, then you may find the option "Save for Enterprise or ad-hoc deployment not present".
This worked for me, hope it could be helpful to anyone who met the same problem as mine.
Also I believe the idea could also be applied to any other thrid-party projects.
Good luck!
Maybe you've done that already, but we have to be sure.
Did you specified in both product and target the code signing identity for adhoc distribution to be your new prov. profile?
Then did you try to archive your app ? (Product -> archive) If it's grayed, just specify the target to be iOS Device, even if no device is plugged.
If Archive is successful, you should have an archive in the organizer. Select it, and choose to distribute as usual.
I experienced the something today. There is no option to export the ad-hoc. so fix this, by "Validate Settings".
Go to your project targets,
Under the configuration list there will be a clock button called "Validate Settings". Click on it
and click "Perform Changes"
Build for Archiving again
To explain the issue, It looks like Xcode understand project's file as Mac Application instead of iOS App.
Hope this helps.
Just as a follow-up, I know several others have answered. I ran into this issue, and the answers in this post were very helpful. Some summarized responses:
For me, this wasn't a profile issue. I have completed a ton of adhoc and distribution app binary builds successfully, so I knew it wasn't a profile problem in my case.
I took one poster's advice, and did the project "validate settings", and it performed some recommended changes...but that didn't solve the issue.
the issue was in fact project libraries that were not making it into the primary bundle. In my case, I had some libraries, that had their own resource bundles. The key is, when you do an archive build, make sure and select the build, select "show in finder", and then "show package contents" to see what additional stuff is not making it into the main application bundle. That's how I located a couple additional resource bundles that were being bundled into some libraries that I didn't even need.
Helpful thing I found was to turn Skip Install off on your main project. If upon archiving you still see a package created (organizer pops up) then a sub-project is still creating a product. Turn off all the sub-projects Skip Install to NO and get your project to the point where an archive does not popup in Organizer. You can then safely turn Skip Install to YES on your main project and little sparkles of achievement will appear in your brain.

Can't find file templates for Source Signing in Xcode 4.2

In my Xcode 4.2 project, I've created an Ad Hoc configuration and want to add the code signing entitlements file to the project, which is usually named Entitlements.plist.
In the past, I create this by selecting a folder in the project tree on the left, then context clicking, selecting "New File...". In the dialog that comes up there's usually a "Code Signing" entry in the iOS tree of the left -- but it's missing now.
The items that are there are as follows:
Cocoa Touch
C and C++
User Interface
Core Data
Resource
Other
I've googled for a solution, and searched on Stackoverflow, but not turned up an answer.
I know that I could create an empty plist manually, and just put in the usual default data which is findable on the web somewhere, but it's bothering me that I can't find the usual thing.
Although I can't find out an actual reference saying that the code signing entitlements template isn't there any more by design, I have found a reference stating entitlements are not needed: https://developer.apple.com/legacy/library/technotes/tn2250/_index.html#//apple_ref/doc/uid/DTS40009933-CH1-TROUBLESHOOTING_GUIDE-CODE_SIGNING_ENTITLEMENTS.
So I'm assuming it's by design in newer versions of XCode.
Try removing the Code Signing Entitlements configuration from the project and target build settings and try your build again.
For more details refer https://developer.apple.com/legacy/library/technotes/tn2250/_index.html#//apple_ref/doc/uid/DTS40009933-CH1-TROUBLESHOOTING_GUIDE-CODE_SIGNING_ENTITLEMENTS

iPhone project "No launchable executable present at path"

I downloaded one of the sample apps for iOS and it gives me the above error.
No launchable executable present at path /Users/..../MyProject/build/Debug-iphonesimulator/MyProject.app
What i do have is the MyProject/build/MyProject.build/Debug-iphonesimulator/GeneratedResources.build/ some files.
No build errors.
When I see in the finder the directory is indeed not even present. What could be the problem ?
Update: Yes, i did try cleaning & deleting Build directory, doesn't help
I also had this same error code for my project. I was using a number in the Target -> Product Name. Once I changed the Product Name of the target to letters only everything worked fine.
Try opening the Info.plist and removing "executable name" value if it's filled with custom string instead of string variable (the one that should look like ${FOO_BAR}, but doesn't).
I had this problem. it turned out I had the active target set incorrectly, in my case to a cocos library instead of to my own app.
After trying the things mentioned here, also make sure you click on "Clean All Targets" then quit XCode and restart XCode. This fixed it for me and many others on the web!
I had the same problem. In my case, I had an additional target for the same project (which contained test libraries). At some point xCode always tried to launch the test binary, regardless of what binary it compiled.
Removing the pbxuser and perspective files (inside project.xcodeproj) solved it for me.

Uploading Binary iPhone App "The signature was invalid" again again and again

I'm going crazy! I'm trying to upload the binary of my first application but I have always the same error!
"The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate."
I did everything, EVERYTHING!!
I created the request for the certificate, used it for both developer and distribution certificate, created the provisioning profile (12 times!!!) always cleaning my keychain and my Xcode deleting the old certificates and profiles..
I reboot the machine, reboot Xcode, the log is correct, but... I can't upload my app!!!!
Checked if my iPhone is connected (i tried with iPhone disconneted too).
I checked the certificate in both my project settings "Distribuition" Configuration (duplicate of "Release" configuration) and in my target settings.
Reveal in finder, compress the app and sent the zip...
I tried with Application Loader and iTunes connect online..
but nothing! NOTHING!!
I've spent 8 hours! And again i can't have my app uploaded!!!
I'm really going crazy!
Can anyone help me pleeease?
Thx!
It seems like there are a LOT of causes for receiving this cryptic and mostly unhelpful email. Even after verifying the use of distribution certificates, cleaning & rebuilding my project, and checking with codesign from the command line (and following instructions from the email), no errors showed up—-but I'd get the "invalid signature" email right after uploading. All the solutions seem anecdotal and obviously depend on what secret error is causing the problem. I've spent the last week pulling my hair out, trying to figure it out for my app—-and finally got it successfully submitted today—so let me share my story and see if it's relevant to your situation.
In my case, I seemed to have a complex cause of having my Entitlement.plist set with an incorrect variable along with the holdover of an old provisioning profile (from a previous Xcode version?) buried deep in the project.pbxproj component of my Xcode project file.
The "aps-environment" variable in my Entitlements.plist was set to "distribution" instead of "production" (I swear I read somewhere in the developer docs that it was supposed to be "distribution"!) But fixing that alone wasn't enough to get my app through. (I must have submitted 100 different combinations of app configurations trying different variables!) Starting with the helpful suggestions from this post on another forum, I dug through the distribution profile and found duplicate entries for some variables. The duplicates had empty quotation marks (i.e. nothing set for the variable) or strange variables or old provisioning profiles which seemed to be causing problems (somehow). Cleaning this up and removing the duplicate lines with bad variables worked in my case. YMMV. But carefully examining the project files ("show contents" on the Xcode project file in finder) seems like a good idea for diagnostics. Good luck!
Been there - done that.
Make sure your certificate is in the "login" keychain, and that that i the default keychain (highlighted bold) in Keychain Access
Make sure you have both the private and public keys for your certificates and that they are valid. You will also need the Apple Worldwide Developer Relations Cert Authority installed.
I assume you have dragged the profile into xcode - easiest to drop them onto the xcode icon on the dock.
Make sure as Paul says, that the bundle identifiers all match up
You say you checked the certificate in the distribution configuration. Its not the certificate you need to concentrate on but the provisioning profile.
Select your Release config top left, click on the project under groups & files and do cmd I. Select build tab and then pick distribution in the top left. Then look at the Code Signing Identity. Pull down the dropdown list and make sure you have the right application identifier, the right profile and the right certificate. Don't use the Automatic Profile Selector.
Hope one of those steps helps!
I was getting the same error when I tried to submit a version update from the Organizer. What solved my issue was using the Application Loader found in the directory /Developer/Applications/Utilities. You'll need to compress your .app file and send the corresponding .zip file. I used this for my initial submission as well, I just thought I'd try the new way. What a pain! Go with Application Loader.
Best solution:
Revoke Distribution Certificate
Create new AppStore provisioning profile
This solved my problem. Spent 4hrs+ :( :)
I just had this problem. I resolved it, after hair-pulling, by going back into Keychain Access one more time and discovering the "Show Expired Certificates" menu item. When I did that, one more expired cert of the kind I had (so far, unsuccessfully) replaced showed up! I had deleted a couple of expired certs already, but this menu item caused another to show up, and after deleting it, my upload worked. I was previously aware that expired certs can get in the way of valid ones, and I STILL wasted a lot of time. Hopefully, this helps some people.

iPhone: Failed to launch simulated application: Unknown error

This is a new iPhone project, only 1 target (different from this question)
On build we get:
Failed to launch simulated application: Unknown error.
The google again gives us nothing, lots of people have encountered this and there are lots of crazy ideas to try "oh clean the build", "clear the cache", "twiddle this flag" and none of them work and work consistently. We can reproduce this on two different machines with SDK 2.2.1 and 3.0 beta. Not the install on the machines since other iphone projects work just fine so we believe it has something to do with the config of this particular project but after combing through the config twice we can't spot the problem.
Vanna, I'd like to buy a clue for $200 please.
Tried: XCode menu->Clear cache
Tried: clean all targets
Tried: rm -rf ~/Library/Application\ Support/iPhone\ Simulator
This happened to me once and I think I saw in a blog to simply quit and restart Xcode. Miraculously, it worked for me. I doubt this is the end all solutions to all problems like these though, but if you haven't yet closed Xcode, it's worth a try.
I sometimes see this problem and it is fixed by rebooting the maching. I suspect the internal state of the simulator gets screwed. Doesn't sound like your problem though.
I agree with MiRAGe; if this persists, start a new project and import your source.
If other projects work fine; start a new one and copy the files. Combing through configs just won't do it (since XCode has, well, thousands of config possibilities).
You can send me a check with the $200.
P.S: When you actually do start a new project, do it step by step. Run it after each change. Maybe you will find your problem. It might be a ton of work, but it might also help the other thousands of lost souls who have an 'Unkown Error'.
Changing the product name worked for me. I tried several different alternatives and all of them worked fine. It was the "magic product name" I used at the onset that failed every time I went back to it. YMMV.
This might be because items are missing for the target. Expand the target and verify that all needed source files and libraries are there. Restart Xcode after you've messed around.
alt text http://pici.se/pictures/TsnTQxhKh.png
Thanks ...Did have the same problem or worse. My app wasn't loading in the simulator, alternatively sometimes the build failed. Now realized it's pretty logical.
When you create a new project and info.plist get associated with the project.
Each time you add a modify/add the target another plist is generated with the new name.
But the original association with the info.plist is still around and there's a conflict.
So remove that association from the current target or better still remove from project and trash the info.plist.
Just make sure in the target settings(do getInfo) the correct info.plist is mentioned.
Note the name for product/target should not have spaces. If you really want it change the bundle display name.
Now the only reason why xcode should be closed is to ensure the project file has registered all changes.
I got this problem when I added the .plist to my target (Info.plist -> Get Info -> Targets -> Target Memberships). It went away when I unchecked it again.
I see that that's separate from the Targets -> -> Get Info -> Build -> Packaging -> "Info.plist file" -> my.plist that trips mentioned, but I still don't really understand what's going on, and definitely don't understand why we get such an unhelpful error message.
I've had this twice for the same reason: adding a folder called Resources to the project. This is a naming conflict with something (though there is nothing called "Resources" in the application bundle by default). It might be that mysterious naming conflicts are a common cause of this problem.
To fix I renamed the folder to something else ("Assets"), manually deleted the entire build folder (clean didn't work) and quit the simulator.
Another thing to try if you are desperate is to change the 'Product Name' setting. This worked for me once when everything else didn't.
I had the same problem because I had changed the BundleName and some other values but not changed the PRODUCT_NAME. I had problems finding where PRODUCT_NAME is defined: Get Info on the target, Build-tab and it is down the list somewhere.
I changed PRODUCT_NAME to match the bundle name, restarted Xcode and it worked.
Fred
I had this problem recently and the fix was ridiculously simple. I remembered that I had been editing the target settings and under the "Properties" tab in the "Executable" field there was a space after the value which was ${EXECUTABLE_NAME}. Yes, a single space. It was impossible to see unless you highlight the field. I figured this out because I had edited that field seeing if I could add a command line option that way. I guess when I cut the additional option back out, I missed a space. So while this is the only possible cause of this problem, it's worth checking out.
Had same problem. None of the answers above worked for me. Then i remember i had just added the icon to the Resources folder before the problem started. Moved icon to Other Sources folder and it worked. Weird!
Thanks Guys.
I had the Product name different than in the info plist. A restart once I fixed that made it all go away.
ps, stackoverflow has been a real help to beginners like me. Thanks from downunder.
I add this issue with a folder named "resources". Rename it, clean every thing and run again.
1) Restart Xcode;
2) Use "Get Info" on Info.plist and uncheck current target (Info.plist would be added anyway).
That's all.
I can confirm that a naming conflict was the source of our problem. We had a filesystem folder named resources inside the Xcode group named Resources. Sometimes we would get the error and a system would lock up and sometimes it would not. Changing the folder to the name assets resolved our problem. After reading some of the above comments - it appears that Xcode group names can clash with directory/folder names.
This happened to me when I changed my version number from 1.0 to 0.1. When I changed it back it started working again.