app has entitlement, still get missing entitlement exception

When I open my app's signing with "codesign -d --ent :- <app path>" I see the iCloud entitlement:


codesign -d --ent :- /Users/jwanner/Library/Mobi/Provisioning\ Profiles/dc54d0d9-2d09-4767-bb0a-df4b886b0e94.mobileprovision

/Users/jwanner/Library/MobileDevice/Provisioning Profiles/dc54d0d9-2d09-4767-bb0a-df4b886b0e94.mobileprovision: code object is not signed at all

Campwood-Mac:~ jwanner$ security cms -D -i /Users/jwanner/Library/MobileDevice/Provisioning\ Profiles/dc54d0d9-2d09-4767-bb0a-df4b886b0e94.mobileprovision

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-/

<plist version="1.0">

<dict>

<key>AppIDName</key>

<string>Xcode iOS App ID com quipzl Quipzl</string>

<key>ApplicationIdentifierPrefix</key>

<array>

<string>PTXZTRRTHH</string>

</array>

<key>CreationDate</key>

<date>2016-03-30T20:57:45Z</date>

<key>Platform</key>

<array>

<string>iOS</string>

</array>

<key>DeveloperCertificates</key>

<array>

<data>MIIFmDCCBICgAwIBAgIIEU4ubnZZGUUwDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNVBAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLDCNBcHBsZSBXb3JsZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9uczFEMEIGA1UEAww7QXBwbGUgV29ybGR3aWRlIERldmVsb3BlciBSZWxhdGlvbnMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTUwNjAxMTkwNjI0WhcNMTYwNTMxMTkwNjI0WjCBizEaMBgGCgmSJomT8ixkAQEMCjlYNE5LU1FFNEYxNDAyBgNVBAMMK2lQaG9uZSBEZXZlbG9wZXI6IEphbWVzIFdhbm5lciAoODJXSFE3RlhMQSkxEzARBgNVBAsMClBUWFpUUlJUSEgxFTATBgNVBAoMDEphbWVzIFdhbm5lcjELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwA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w9c0GPxY5kQiaxzdw9+H9+95pWSlGrsAoXv5zEscZqwhJT/V39PAh4e/mRZj2Ho/kRVrJTjDUKLjO7M8TBvpkQreNcX+jzf5ly0rOnEKbzVjowXvURVvLuF70Y411mY32DcLBrrlM647X7Qf73HafXW6V4PqGkKAZzJRhfDPSibga9x45IngfWQdg9/f8WPOWu3TXuOUtNmF7TnfRv0dTeuMEwFrCQHL+/KM6OAgO63pwqzAIM/4bkeEC97ETVA6ni7FIS+/NXJZwwMwEJVAz1g/axmIimqMkpEKxH4Y6GBbU3udDbvO7J8UyJiktVc4/+Jc/AEp2yuvCI2s=</data>

</array>

<key>Entitlements</key>

<dict>

<key>keychain-access-groups</key>

<array>

<string>PTXZTRRTHH.*</string>

</array>

<key>get-task-allow</key>

<true/>

<key>application-identifier</key>

<string>PTXZTRRTHH.com.quipzl.Quipzl</string>

<key>com.apple.developer.ubiquity-kvstore-identifier</key>

<string>PTXZTRRTHH.*</string>

<key>com.apple.developer.icloud-services</key>

<string>*</string>

<key>com.apple.developer.icloud-container-environment</key>

<array>

<string>Development</string>

<string>Production</string>

</array>

<key>com.apple.developer.icloud-container-identifiers</key>

<array>

<string>iCloud.com.quipzl.Quipzl</string>

</array>

<key>com.apple.developer.icloud-container-development-container-identifiers</key>

<array>

<string>iCloud.com.quipzl.Quipzl</string>

</array>

<key>com.apple.developer.ubiquity-container-identifiers</key>

<array>

<string>iCloud.com.quipzl.Quipzl</string>

</array>

<key>com.apple.developer.team-identifier</key>

<string>PTXZTRRTHH</string>

<key>aps-environment</key>

<string>development</string>

</dict>

<key>ExpirationDate</key>

<date>2017-03-30T20:57:45Z</date>

<key>Name</key>

<string>iOS Team Provisioning Profile: com.quipzl.Quipzl</string>

<key>ProvisionedDevices</key>

<array>

<string>7d945c0fd8184f8fb7fcebc1fa268e7a16af7b60</string>

<string>a1c57ab44f55af42eeb082238553935bba6e822d</string>

<string>b3d01f91621eff2e2f6ea34bf047bd54196d4554</string>

<string>a9dd6e5f465c7a71ee8d825eba8b1bca828d5a33</string>

<string>a9dd6e5f465c7a71ee8d825eba8b1bca828d5a33</string>

<string>ac8402ba017620020929610800fd3ac537eb5f08</string>

<string>04fc3f09b20ee8625287461ea600fe044f61a81b</string>

</array>

<key>TeamIdentifier</key>

<array>

<string>PTXZTRRTHH</string>

</array>

<key>TeamName</key>

<string>Quipzl LLC</string>

<key>TimeToLive</key>

<integer>365</integer>

<key>UUID</key>

<string>dc54d0d9-2d09-4767-bb0a-df4b886b0e94</string>

<key>Version</key>

<integer>1</integer>

</dict>

</plist>Campwood-Mac:~ jcodesign -d --ent :- /Users/jwanner/Library/Developer/Xcode/DerivedData/Quipzl-cowjhedmbijlxgalwenluaqvvadq/Build/Products/Debug-iphoneos/Quipzl.app

Executable=/Users/jwanner/Library/Developer/Xcode/DerivedData/Quipzl-cowjhedmbijlxgalwenluaqvvadq/Build/Products/Debug-iphoneos/Quipzl.app/Quipzl

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-/

<plist version="1.0">

<dict>

<key>application-identifier</key>

<string>PTXZTRRTHH.com.quipzl.Quipzl</string>

<key>aps-environment</key>

<string>development</string>

<key>com.apple.developer.team-identifier</key>

<string>PTXZTRRTHH</string>

<key>get-task-allow</key>

<true/>

<key>keychain-access-groups</key>

<array>

<string>PTXZTRRTHH.com.quipzl.Quipzl</string>

</array>

</dict>

</plist>

Campwood-Mac:~ jwanner$

[Restored]

Last login: Mon Apr 4 13:37:32 on console

Campwood-Mac:~ jwanner$

[Restored]

Last login: Mon Apr 4 13:41:11 on ttys000


However, when I try to execute the following Objective C statement:

CKContainer * dbContainer = [CKContainer defaultContainer];

2016-04-04 14:16:03.644 Quipzl[1757:1302792] *** Terminating app due to uncaught exception 'CKException', reason: 'The application is missing required entitlement com.apple.developer.icloud-services'

*** First throw call stack:

(0x24bc010b 0x24366e17 0x2bf14e15 0x2bf13d89 0x2bf14569 0x2bf13d2b 0x1d0c83 0x1d18a1 0x2bf13cf7 0x773f9 0x57709 0x5663b 0x28cf8d59 0x26df7f99 0x26df3695 0x26df3529 0x26df2a49 0x26df26fb 0x26debebb 0x24b82f59 0x24b8125d 0x24ad4c19 0x24ad49e5 0x28d6a5bd 0x28d64ba1 0x77c35 0x24783873)

libc++abi.dylib: terminating with uncaught exception of type CKException


I have gone through the entitlements troubleshooting web page in detail and don't find any errors. I have iCloud Drive enabled in my iPad Settings for iCloud.


What am I missing here?

Answered by jwanner in 137949022

Finally solved this problem. It wasn't due to any missing entitlements like the exception indicated, and I don't know exactly what change fixed the problem. However the following process worked:

1) create a new iOS project of the same type as the one that was crashing.

2) add the statement "[CKContainer defaultContainer];" to the viewDidLoad method.

3) run this empty app and make sure it doesn't crash.

4) go through all of the app parameters in the new and old apps and make the old app values the same as the new app values.

Accepted Answer

Finally solved this problem. It wasn't due to any missing entitlements like the exception indicated, and I don't know exactly what change fixed the problem. However the following process worked:

1) create a new iOS project of the same type as the one that was crashing.

2) add the statement "[CKContainer defaultContainer];" to the viewDidLoad method.

3) run this empty app and make sure it doesn't crash.

4) go through all of the app parameters in the new and old apps and make the old app values the same as the new app values.

>I don't know exactly what change fixed the problem.


What changed may be your use of a newer version Xcode that squashed a bug responsible for this issue in an older Xcode.

app has entitlement, still get missing entitlement exception
 
 
Q