Grzegorz Aperliński
Grzegorz Aperliński

Reputation: 918

Using iCloud in iOS app extension

I'm writing an iMessage extension and encountered a problem when trying to upload data using CloudKit.

When I try to upload data from within the container application, everything works fine, but when I'm running the same code in the extension I get the following exception:

'CKException', reason: 'The application is missing required entitlement com.apple.developer.icloud-services'

Is there a way to set entitlements for the app extension or is not being apple to connect to iCloud from an extension deliberate design choice?

Upvotes: 3

Views: 860

Answers (1)

Grzegorz Aperliński
Grzegorz Aperliński

Reputation: 918

As usual, I'm being stupid. I forgot to enable iCloud capability for BOTH the container app AND the extension target. Then, I needed to specify the same iCloud container for both targets. Works like a charm.

Upvotes: 1

Related Questions