Search code examples
xcodeicloudcloudkit

Cloudkit subscription error: BAD_REQUEST (just production mode)


I make an App with Cloudkit subscription. (see this code). I tested developer mode, and work fine. I publish my App, and that is not working :( I get the following error message (Cloudkit Dashboard Log) error: BAD_REQUEST operation: subscription modify database: private zone: _zoneWide

    let predicate = NSPredicate(value: true)
    let subscription = CKQuerySubscription(recordType: "recordDT",
                                           predicate: predicate,
                                           subscriptionID: subscriptionID,
                                           options: [.firesOnRecordCreation, .firesOnRecordDeletion, .firesOnRecordUpdate])
    let notification = CKNotificationInfo()
    notification.alertBody = "change cloudkit"
    notification.shouldSendContentAvailable = true
    subscription.notificationInfo = notification
    publicDB.save(subscription) { result, error in
        if let error = error {
            print(error.localizedDescription)
        } 
    }

I found this log: enter image description here

What could be the problem?


Solution

  • I Found the root cause of the error :)

    I saw this the icloudkit dashboard webpage "Subscription types are automatically created when your app creates a Query Subscription." This work fine the developer pages, but not true the production page :(

    Must be use "deploy to production" function, after the subscripttion was created