Could not launch 'app' with iCloud container - xcode

I have an OS X app targeting 10.7 (Lion) platform. I use XCode 4.4 on a development machine where iCloud is enabled. The OS X version on this machine is 10.8 (Mountain Lion).
I have an APP ID that I enabled iCloud using the Developer Certificate Utility: com.company.appname. The utility shows a green tick next to iCloud label under description of the App ID.
From XCode Target/Summary tab I enabled Entitlements and added iCloud Container com.company.appname. Of course internally it is preceded by the team id in the Entitlements file: teamid.com.company.appname.
I also have a valid (green ticked) provisioning profile on my Mac with the same id:teamid.com.company.appname.
Derived Data locations is set to Relative from XCode/Preferences.
The app builds OK. But when I run it I get "Could not launch "appname". Permission denied." error.
If I remove the iCloud container id com.company.appname from iCloud Containers list box under Entitlements and build the app, it runs OK. But of course I cannot access iCloud container enabled for the app.
I have been working on this problem for the past 24 hours. I have read the guides; Developing for the App Store, App Sandbox Design Guide, and Entitlement Key Reference inside out. Yet I am stuck. What went wrong?
I am desperate and I will be grateful if you can help me.

I think the most likely problem is that the AppID, the Entitlement and your provisioning profile do not match each other.
This can happen easily if you experiment a lot with those settings. It should work right out of the box if you create a fresh new project with valid settings, but it might get corrupted if you convert, change or edit existing projects.
Do not forget about the 10-digit prefix of your app bundle id. This is required, esp. for iCloud Key-Value-Storage!
Log into developer.apple.com, check the AppIDs tab
Create an AppID if necessary
Check the iCloud settings for this app
Note down the exact app identifier in the form ABCDE01234.com.domain.app
Switch back to Xcode, update your Provisioning Profiles and Entitlements in the "Teams" section of the "Devices" Tab in the Organizer
Go to the project settings, select the app target and search for "Code Sign"
Make sure the correct code signing identity is selected (see the application identifier above)
Go to the summary tab and put in your app ID
Open the Entitlements file and check if the right ID is in there as well.
Then it should work.
Hopefully.
Edit: thought it would be nice to add the link to the app id center:
https://developer.apple.com/certificates/index.action#bundlelist

Related

ERROR ITMS-90283 with "Invalid 'com.apple.application-identifier' entitlement value" when submitting Mac Catalyst app

I'm trying to submit a Mac Catalyst app for the first time, but the upload keeps failing with this error message:
ERROR ITMS-90283: "Invalid Provisioning Profile. The provisioning profile included in the bundle maccatalyst.com.arlomedia.setlistmaker [maccatalyst.com.arlomedia.setlistmaker.pkg/Payload/SetListMaker.app] is invalid. [Invalid 'com.apple.application-identifier' entitlement value.] For more information, visit the macOS Developer Portal."
This happens if I manually or automatically sign the app. With manual signing, I have a new macOS App Store provisioning profile that I created as a Mac Catalyst profile using the associated iOS app ID. This shows as valid in the provisioning portal, and I can build (archive) the app just fine with this profile selected:
When I go through the submission process in the Xcode organizer, I have to "Import" the provisioning profile every time (I downloaded the provisioning file, and just select the downloaded file here), which is odd:
But after I select the file, I can click its info icon and everything looks correct:
Then I proceed with the upload, and when the progress bar reaches the end, the error appears and the submission fails.
The error message indicates something is wrong with the application-identifier, but I've checked this everywhere I can find it and it looks correct. I'm using automatically derived bundle IDs, which prefixes "maccatalyst" onto my iOS bundle ID. In some places where this appears, the ID is also prefixed with the App ID Prefix from the apps Identifier record in the provisioning portal. The screen shot above shows the last letter of the App ID cut off, but I think that's just the display in Xcode; if I open the provisioning file, the full ID is listed.
I have another app I've been working on at the same time and I was able to submit it successfully. I opened the archived .app files for both projects and compared the embedded provisioning profiles, and the only differences are things I would expect, like the app name and export time. The application-identifers and bundle IDs are formatted the same way, with the correct app prefixes. I also compared the info.plist files for the two apps and didn't see any significant differences there, either. The other app also required me to select the profile during the submission process, so it seems like that's not a problem (although with my iOS submissions, the profile name appears there automatically).
When I turn on automatic signing, some upload steps are skipped, but I get the same error message at the end of the upload. If I use the Validate App button instead of the Distribute App button in the Xcode organizer, I go through the same steps and get the same error message.
I've compared the setup of the app IDs and profiles of both apps, the signing settings, the build settings, the App Information pages in iTunes Connect ... everything is set up the same way. Does anyone know what else I should check?
I finally got this to work by giving up on the automatically derived "maccatalyst" bundle ID and using a custom bundle ID. Here are the steps I took:
In Xcode, turn off the "Derive Mac Catalyst Product Bundle Identifier" build setting.
Edit the "Product Bundle Identifier" build setting and add a separate bundle ID for the macOS platform. (screen shot 1)
In the iOS Provisioning Portal, edit the App ID for the associated iOS app and turn off the Mac Catalyst option.
Create a new App ID for the Mac version of the app, and enter the new macOS bundle ID.
Create new development and distribution profiles using the new App ID. When creating the profiles, these must be Mac Catalyst, not Mac, profiles. Xcode would only accept Mac Catalyst profiles when validating. (screen shot 2)
In App Store Connect, edit the macOS app record and change the bundle ID from the maccatalyst ID to the custom ID. This was still editable because I hadn't yet successfully uploaded a binary.
My new profiles now appear as Eligible on the Signing & Capabilities tab in Xcode, but they do not appear as options on the validation page when submitting. However, as with my original setup, I can click the Import Profile option there and select the file downloaded from the provisioning portal.
Note that this is the setup to use if you do not want Universal Purchase. If you do want that, you would need to use the same bundle ID as for the iOS app, and you might need to wait until Xcode 11.4 is released in order to submit the app with that setup. I'm not sure about that, but I am sure that you cannot submit apps with the Xcode 11.4 beta, because I tried it. (screen shot 3)
I didn't try automatic signing with the custom bundle ID setup. I think that would work because I think somehow the problem was related to the automatically derived bundle ID. That is basically deprecated with the upcoming Xcode 11.4 and Universal Purchase capability, so I suspect that a change on Apple's end has broken the validation of that style of bundle ID, perhaps only in limited cases that affected my app due to some factor that neither I nor Apple were able to identify.
Custom bundle ID settings:
"Profile is not a 'Mac Catalyst App Store' profile":
Cannot submit from Xcode beta:
I found this document:
Technical Q&A QA1710: Why do I get an "Invalid application-identifier Entitlement" error?
It states:
In modern versions of Xcode, you don't need to supply a value for this entitlement yourself, so the error can be avoided by simply removing the application identifier entitlement from your custom Entitlements.plist.
Xcode builds the application identifier entitlement for you based on the Bundle Identifier property defined in your Xcode project's Target > Info tab, so setting the correct Bundle Identifier in Xcode is imperative.
I don't have either of those problems, but maybe it will help someone else receiving this error.

iTunes Connect and Xcode 8: your app has changed to invalid binary

Last week, with Xcode 7, I was able to upload without any issue. But today I am getting the message your app has changed to invalid binary.
I have seen that now with Xcode 8 a new icon 20x20 2x and 3x is added. I added one, but still getting the error.
Does anyone had similar problem?
Сheck your email!
In my case, I wasted a lot of time because I did not check my email. When you get such an error, Apple sends you an email with it's description.
For example, this is what Apple sent me:
"This app attempts to access privacy-sensitive data without a usage
description. The app's Info.plist must contain an
NSCameraUsageDescription key with a string value explaining to the
user how the app uses this data."
After days of wrestling with the same problem I finally got my app successfully submitted, but only after being on the phone with Apple Developer support.
A couple of things to keep in mind:
Make sure you set the Info.plist description keys for any entitlements. This is necessary for iOS apps. Mine was a macOS app, so this didn't apply.
Head over to iTunes Connect, and recreate all your provisioning profiles and code signing certificates if you're not 100% sure that they're valid. You can do it for both Developer and Distribution.
In Xcode, turn off automatic code signing for your app, and any build targets (you can try automatic code signing in Xcode after completing steps #2 and #4 but that wasn't what worked for me).
Go to Xcode preferences, and click your development team, and in the sheet that comes up, you should see some "Download" buttons beside the newly created (in iTunes Connect) code signing certificates and provisioning profiles. Click them all. And so you don't get confused in step #5, delete all the other stale provisioning profiles and code signing identities for this app.
In Build Settings for each of your targets, make sure that the Release build setting for code signing, and provision profile are set to the above newly created code signing certificate and provisioning profile.
Bump your build number.
Deep clean your project (Option-Shift-Command-K).
Archive build your app.
In the Organizer that opens up, select the newly archived app, and validate (it always validated, but I still would get Invalid Binary later).
Export the build and select the option "Save for Mac App Store Deployment" or similar.
When prompted, use the same Provisioning Profiles you used previously and save.
Open the .pkg in Application Loader which you can launch from Xcode > Open Developer Tool > Application Loader menu.
I was't getting any emails on the Invalid Binary issue. Instead, I was lucky enough to have set up my iPad with iTunes Connect, and so, like clock-work, I was getting notifications within a couple minutes of uploading the app: "Your app ... has changed to Invalid Binary."
If you don't get one of these Invalid Binary notifications, that's a good sign. Another 10-15 minutes later, I checked the iTunes Connect portal, and I could finally add the uploaded build and submit for review.
After a while of searching, as a last-ditch effort I added every possible 'NS...UsageDescription into each of my target's Info.plist and this seems to have worked. After process of elimination, I deduced that it was either the NSAppleMusicUsageDescription or the NSFaceIDUsageDescription key-string pair that was preventing the upload from being successful so I just added them even though I don't use either in my project. I have also read on some other threads that something with a new version of Xcode required them to have the NSAppleMusicUsageDescription even though they didn't use anything related to Apple Music.

Run Mac App with CloudKit connected to the Production environment

Has anyone succeeded to run a Developer ID signed Mac App with CloudKit and with access to the Production environment, using Xcode 8 beta 3? According to this diagram of Apple it should be possible, but all my attempts lead to crashes. What are the exact steps to follow?
My attempts until now includes the use of a "Mac DirectDistribution" Provisioning Profile that points to an App ID with CloudKit enabled and with access to an iCloud Container.
My CloudKit enabled-app works perfectly with a standard App Store configuration, but I want to test it with a Production environment.
Just add the following entry to your entitlement plist and do a clean build (shift+command k). No other action is needed: (string to copy: com.apple.developer.icloud-container-environment)
After countless experiments I found the following working solution to test CloudKit on the Mac with Production data, using Xcode 7.3:
In your App project, choose Developer ID in Targets > Identity > Signing
In the Entitlements file add a new line with key "com.apple.developer.icloud-container-environment" with value "Production"
Run the App (debug modus)
Export the app to an Archive, choose Export and select "Export as a Mac Application" to produce a Developer ID-based release version.
The steps are more or less the same if you use Xcode 8, but you have the extra option to disable the App Sandbox.
For Mac the easiest way is to just after Archive click Distribute App then choose Development and click next then choose your iCloud Environment (Production/Test) and save the app wherever you want. This version will access your production iCloud.
enter image description here
enter image description here

iCloud set up and provisioning

I am trying to set up iCloud within my iOS application, I have done the following:
Removed all old certs on mac.
Added iCloud to the App in Dev Console - created new container and added to app
Redone the dev provision and downloaded
Installed the provision
Added the iCloud Entitlement to the app
And this is where is all goes wrong...
I can't get the app running again, the app is building but I am getting an error saying:
The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile.
(0xE8008016).
Any ideas??
UPDATE: I have managed to be able to run the application to get everything programmed and put in place, everything is set up iTunes Connect end, all provisions are valid and sync'd.
Now I am getting errors during validation...
There are 4: Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported by iOS. Specifically, key 'com.apple.developer.icloud-container-identifiers' in Payload ------- not supported
Other 3 are similar for other containers!
Maybe it's a late comment, but I post it here in case that somebody is struggling for the same reason.
I encountered this issue on Xcode8 recently when I was trying to archive. Generally, I enabled iCloud with Xcode in following steps:
Enable iCloud inCapabilities panel in my target by setting the toggle to ON.
Check iCloud under my App Identifier in Member Center turns green automatically, and a iCloud container is created automatically with my App Identifier. (Apple's system does this for us.)
Regenerate my certificate with my App Identifier.
Create a new provisioning profile.
Download and install the new certificate and provisioning profile
Select the new provisioning profile in Signing(Release) section in General panel in my target.
Then I got errors like:
Provisioning profile "iCloud Test" doesn't include the com.apple.developer.ubiquity-container-identifiers,
com.apple.developer.icloud-container-identifiers,
and com.apple.developer.icloud-services entitlements.
Code signing is required for product type 'Application' in SDK 'iOS 10.1'
Code signing is required for product type 'Application' in SDK 'iOS 10.1'
At last I found that there were two options in iCloud section under my App Identifier in Member Center. By default, the Compatible with Xcode 5 was selected, but I succeeded by selecting the other option.
If you're just adding iCloud to an app for the first time or want to upgrade to use CloudKit after using an older iCloud container:
Go to the Apple Development Center.
Choose Certificates, IDs & Profiles.
Use the dropdown on the top left to switch between iOS/tvOS/watchOS or macOS
Choose App IDs under the Identifiers section.
Choose your app from the list.
Scroll down to iCloud and make sure it is enabled with a green dot.
If it's not enabled or has a yellow dot, click the button at the bottom of the page to Edit and make sure you've checked iCloud service.
You may also need to create a container under the iCloud Containers section then associate it with this app.
After submitting a report to Apple, it turns out that Apple systems are useless AGAIN!
Ok, so if you are creating a NEW application or you are only just adding iCloud to your application - you will need to make sure the system doesn't pick up or create a iOS8 cloud container!
If it does you need to remove it from your app entitlements file, remove the selected containers in the Apple Developer Console and re-download certs again!
Thanks Apple again!
I got blamed for using pre-released software! I haven't touch Xcode 6 yet!!!
What I did:
- leave only com.apple.developer.icloud-services in entitlements file
- in Capabilities under iCloud marked key value storage and iCloud Documents (cloud kit EMPTY)
- Containers set to specify custom but do not select any of your containers
- This will probably give you RED warning sign under steps but leave it as it is DO NOT FIX
- Regarding provisioning profile Development and Distribution profiles have to have App ID which has iCloud enabled but NOT linked to any container
- In those provisioning profiles set under iCloud OLD version for Xcode 5 etc. not a new one related to iCloud containers
I had an error of "Add iCloud Containers to your App ID".
Automatic signing was unable to resolve an issue with target's entitlements.
I don't even use iCloud Containers, only Key-value storage(keychain).
I also switched in iCloud section under my App Identifier in Member Center from "Compatible with Xcode 5" to "Include CloudKit support (requires Xcode 6)" problem still remains.
So I fixed it like this:
Enable iCloud Capabilities panel in my target by setting the
toggle to ON.
Turn on "Include CloudKit support (requires Xcode 6)" in Member
Center (still got same error).
in Xcode in iCloud Capabilities TURN ON CloudKit (even if you don't
need it) and then turn OFF.
And then problem solved for me!

A valid provisioning profile matching the application's identifier could not be found

This has been asked before, but the answers to previous questions are not solving my issue.
I'm trying to build a simple Hello World app called (CalculatorBrain) from Stanford iTunes U courses. I can run it in the Simulator fine, but I'd like to get it on my iPhone 4S.
I sync my iPhone 4S through iTunes on my Windows machine. Always have. Figured I should list this detail.
Anyway, back to my Macbook (Mountain Lion). I'm running the most recent XCode 4.6.2 (4H1003) and my iPhone is also the most recent at 6.1.3 I believe.
I went to the Provisioning Portal at the Apple developer page. I added my 4S. I called it JohnSmith, and gave it the phones UDID.
In XCode, I opened the Organizer, Devices is highlighted by default. I put the passcode in my iPhone, and plugged it into my Macbook. Devices finds my iPhone. If I click on Provisioning Profiles and try 'Add Device to Provisioning Portal', I get a "A device with number already exists on this team." Great. I know it's added for sure then. All good news so far.
In my Hello World app, CalculatorBrain-Info.plist my Bundle Identifier is "com.JohnSmith.CalculatorBrain". Bundle display name is "${PRODUCT_NAME}" and executable file is "${EXECUTABLE_NAME}" if that matters.
In the Navigator, if I highlight my project, and bring up the Build Settings, under Code Signing Identity I get the options...
Don't Sign Code
Automatic Profile Selector
- iPhone Developer
- iPhone Distribution
Identities without Provisioning Profiles
- iPhone Developer: John Smith (R............K)
- iPhone Distribution: John Smith (Y.............5)
Other...
I've tried all of these. I'm assuming I'm supposed to use the iPhone Developer: John Smith one... but it's saying it's an identity without Provisioning Profiles.
What's going on here? What do I need to do to get this to work?
Based on your description, it sounds like the missing element is that you need to go back to the 'Certificates, Identifiers, and Profiles' tool, generate a Development Provisioning Profile for the AppID of your HelloWorld app, then install that profile on your development machine. At a high level, this is composed of the following steps:
Locate the AppID for your project in Xcode.
Verify that you've setup that AppID in 'Certificates, Identifiers, and Profiles'.
Create a Development Provisioning Profile for that AppId, your development certificate, and one or more registered test devices.
Download and Install the Provisioning Profile in Xcode.
Configure your project to Code Sign using this Profile and Linked Code Signing Identity.
Build to device!
The 'Code Signing Identity' build configuration item you have mentioned is very much dependent on both your project's settings as well as the Provisioning Profiles available on your development machine. I recently answered a tangentially related question 'What are code signing identities?' that may be helpful in seeing what information Code Signing is using and how you can check that you've got your development machine setup to be able to Code Sign your project.
...and now, on to more specific HOWTOs to help work through your Code Signing question:
Locating Project's AppID
The AppID uniquely defines an application in the iOS ecosystem and is one of the things you first create when starting a new Xcode project. This AppID is what you need to register in the 'Certificates, Identifiers, and Profiles' tool to get started with Provisioning.
In the Project Navigator (CMD+1), click on your project name (likely 'CalculatorBrain'). This will present the project's settings.
Select [Your Project Name] > Summary Tab as shown in the screen clipping from above (MyiOSApplication).
Your iOS AppID is presented in the 'Bundle Identifier' field. Snag a copy of this string, you'll need it next.
Verify (or Setup) the AppID
Navigate to http://developer.apple.com/ios and access the 'Certificates, Identifiers, and Profiles' tool.
After logging in, select 'Identifiers'.
Check that the AppID you found in the previous section is present in the list of App Identifiers. If so, take note of the App ID Name and skip to the next section, otherwise...
Click the 'Add' (Plus) button in the upper right corner, provide a name for this App ID (can be whatever you want, just so long as it doesn't have special characters.)
Scroll to the bottom of the page, and paste a copy of your App ID from the previous section in the 'Bundle ID' field. under 'Explicit App ID'.
Click 'Continue'.
Do note that the AppID must be unique across the iOS Ecosystem -- you may get an error if the AppID you've selected is already in use. If so, change your 'Bundle ID' to something unique -- just be sure to update the 'Bundle ID' setting in your Xcode project to match whatever you settle on.
Creating a Development Provisioning Profile
Now that the App ID is registered, you are now ready to create a Development Provisioning Profile linking your App ID, Development Certificate, and Test Device ID(s) together.
Within the 'Certificates, Identities, Profiles' tool, navigate to 'Provisioning Profiles'.
Click on the 'Add' (Plus) button in the upper right corner.
Select 'iOS App Development' in the 'Select Type' step and then click 'Continue'.
Select your App ID from the drop down list of App IDs and then click 'Continue'.
Check the box next to your Development Certificate and then click 'Continue'.
Check the box next to the test device(s) you want to authorize to install this app and then click 'Continue'.
Key in a Profile Name (again omitting special characters) then click 'Generate'.
Download and Install Provisioning Profile
Once the Provisioning Profile is generated, the tool will provide you with a link to be able to download
Download the Provisioning Profile by clicking on the 'Download' link.
Drag Provisioning Profile from your Download location and drop it on the Xcode Dock Icon or double-click to open it.
Configure Code Signing Identity
Sounds like you already know where this is located, but just in case:
In the Project Navigator (CMD+1), click on your project name (likely 'CalculatorBrain'). This will present the project's settings.
Select [Your Project Name] > Build Settings Tab.
Scroll to the 'Code Signing Identity' item.
In theory you would like to use the 'Automatic Profile Selector' option which will attempt to match your AppID to an installed Provisioning Profile, but you can also scroll through the list and pick a specific mapping of Bundle ID/AppId to iOS Certificate.
Also, my own Xcode doesn't always seem to catch on to changes to freshly-installed provisioning profiles -- It is unclear if this is just a quirk of my own Xcode install or if there is a bug in Xcode. Either way, quitting and relaunching Xcode seems to trigger a reindex/refresh of profiles.
Anyway, select the option that matches your AppId/BundleId and your Developer Certificate.
Assuming the problem was a missing/incomplete/expired Provisioning Profile, then this should help get you up and running. If not, we'll have to dig into other potential settings or certificates issues that could be tripping up your Code Signature operation.
I had very similar kind of problem, tried every option to those Code Signing's and the actual solution to mine was:
- Restarted Xcode
- Go to "Window->Organizer"
- Then "Editor" and
- "Refresh from Developer Portal"
Then I just "Set the active scheme" to "iPhone (Petri)" on beside the Run and Stop buttons.
Please make sure Targets is checked instead of projects.
In my case device has 3 provision profiles of the same name. During development I updated provision profile a few times and every time new updated profile was added to device without removing the old one. So xcode searched first provision profile wich was wrong at that moment and throwed error in my face.
So, what should you do:
Open "Devices" window (Cmd + Shif + 2)
Search for your Device and select It
In the left bottom corner press on the "settings" button
Press "Provision profiles"
Search for dublicates. I found 3 items of profiles with the same name
removed all but the latest one

Resources