Search code examples
ioscloudkit

How to resolve CloudKit functionality inconsistency between devices


I've integrated CloudKit into my iOS app and I'm encountering functionality inconsistency between devices.

One of my users has an iPod 5th Gen and an iPhone 6. If they use the iPod everything works as expected. However if they use the iPhone 6 they can only receive data and notifications, they can't make changes of their own. When the iPhone attempts to make changes to the iCloud public database I receive no errors and changes are made locally, they just never make it to the server (everything appears to work, it just doesn't).

Given that the user can use the iPod successfully but the same iCloud account only receives data on the iPhone suggests to me that this might be a permissions or settings issue.

I've checked:

  • User is logged into iCloud
  • iCloud drive is on
  • The app appears enabled in the iCloud Drive menu in settings
  • The app appears enabled under the "Look Me Up By Email" menu

Other details:

  • The app is available through TestFlight
  • The app is using the production container (required for TestFlight)

I don't know what code to supply because the app functions as expected on other devices but let me know what could help. Any help would be greatly appreciated.


Solution

  • This was resolved by changing my modify operations qualityOfService property to .UserInitiated.

    After I reviewed the completion handler for my CKModifyRecordsOperation I realized that I was saving data necessary for local functionality regardless of whether the completion handler received an error or not (and incidentally, whether it was executed or not). So when it appeared to me that my operation was being run and returning no errors, it actually wasn't being run at all. Changing the qualityOfService appears to have resolved this.

    Answer that led to the solution