I am having problems with saving/retrieving keys/values from iCloud. My problem is essentially saving a key to iCloud and retrieving nil when trying to read the same key with another device.
Investigating this issue, I have found this on the device console.
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: Dec 3 18:11:16 SecTrustEvaluate [leaf CriticalExtensions IssuerCommonName]
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'com.apple.developer.ubiquity-container-identifiers' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'com.apple.developer.ubiquity-kvstore-identifier' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'com.apple.developer.ubiquity-container-identifiers' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'com.apple.developer.ubiquity-kvstore-identifier' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'keychain-access-groups' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'com.apple.developer.ubiquity-container-identifiers' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'com.apple.developer.ubiquity-kvstore-identifier' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'com.apple.developer.ubiquity-container-identifiers' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'com.apple.developer.ubiquity-kvstore-identifier' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Dec 3 18:11:16 iPhone-4S amfid[641] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
I have removed all provisioning profiles and recreated them, removed them from Xcode and reinstalled, rebooted the devices, but the errors continue.
This is my entitlements file content (the file was created automatically by Xcode)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>$(TeamIdentifierPrefix)com.myCompany.myApp</string>
</array>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(TeamIdentifierPrefix)com.myCompany.myApp</string>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.myCompany.myApp</string>
</array>
</dict>
</plist>
How do I solve this?
Finally! I found this solution and it worked!!!! The solution to this problem is to delete all iCloud accounts from all devices you are testing the app and create them again!