Skip to content

Sync changes from App Extensions to CloudKit without opening the app #39

@shumbo

Description

@shumbo

I intend to use Core Data with CloudKit to sync data between devices. While this works fine on the app, it has problems around app extensions.

Svadilfari Extension (Safari Extension) allows users to add/remove entries to the exclusion list. We expect that the changes are synchronized between devices in a reasonable time. However, the first version of iCloud Sync only uploads changes when the user opens the app.

I tried to use NSPersistentCloudKitContainer from the extension, but it did not upload the changes to the cloud. Moreover, it seemed that the extension created its own copy of the database, and therefore, the changes were not visible from the app.

There are several posts on Apple Developer Forums regarding this issue:

I couldn't get around this. Therefore in the initial version,

  • the Safari extension writes to the shared database on local (using app groups)
  • when users open the app, the changes are uploaded to CloudKit

However, this behavior is not intuitive and ideal. I want app extensions to directly upload changes to CloudKit and have those changes available in other devices without opening the app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions