iCloud set up and provisioning - xcode

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!

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.

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

WatchKit Upload

I am trying to submit my WatchKit app t iTunesConnect. I click "Archive" and then validate and I am shown the message below. I have created an App Id for the app, extension and WatchKit App as well as distribution profiles.
Where am I going wrong?
Thanks
To properly sign a watch app, you need three different App IDs and each App ID needs a provision profile.
Go to Developer Member Center
Add/Edit the three App IDs:
One for your main App bundle, you may need to add the entitlements you need, like App Groups, Keychain Access Group.
One for your watchkit extension bundle, you may need to add the entitlements you need.
One for your watchkit app bundle. No entitlements needed.
Delete the distribution provision profiles for the three App IDs, if they already exists.
Add three new distribution provision profiles for the three App IDs.
Now go back to Xcode, open Preference and go to Accounts.
Choose your Apple ID, click View Details on the bottom right.
Click the refresh button on the bottom left, wait for the list of provision profiles to change.
In Build Settings for all your targets, configure the Code Signing part as below.
Try Archive again.
When you submit your app, XCode will ask you to confirm the provision profile it uses to sign each of your bundles. You need to be sure that the provision profile names match those you configured in Developer Member Center.
I have uploaded one app to itunesconnect with watch app.
This is very simple. You need to create 3 appstore provisioning profiles and the bundle identifier for the extention and watchApp are like
com.abc.app - Phone app
com.abc.app.extention - Extention
com.abc.app.watchapp - watch app
and also sync app group in capabilities tab in all 3 targets.
All are well.
you just needs to create Archive for only Phone App (Main Target). That's It. When user will download your app. And if phone have attached Watch then this will automatically get informed to you for watchapp download.
Judging by the screenshot, it looks like your profiles need to have the missing entitlements (beta-reports-active, keychain-access-groups) added to them.
You will need to create a provisioning profile for the watchkit extension as well as the provision that you have for your app.
If you download the Apple Lister App Code Sample there is a guide to getting started that show you everything that you need to do to setup your app to work properly on a device with Apple Watch.
https://developer.apple.com/library/ios/samplecode/Lister/Introduction/Intro.html
Click on the Download Sample Code button, and in that folder there is a file called iOS and Watch Quick Start.pdf
Using XCode 6.3 solved the problem to me.
I previously used 3 provisionning profiles for watch apps
source : Watchkit Extension - No matching provisioning profiles found

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

Could not launch 'app' with iCloud container

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

Resources