CloudKit Inactive Notification Subscription Not Working

I am trying to subscribe to push notifications using CloudKit. I get this error:

<CKError 0x170c5b1e0: "Unknown Item" (11/2003); server message = "could not find required field fieldID="25"" 

from this code:

 let subscription = CKSubscription(recordType: "PlayerData", predicate: NSPredicate(format: "TRUEPREDICATE"), options: CKSubscriptionOptions.FiresOnRecordCreation) let notificationInfo = CKNotificationInfo() notificationInfo.shouldBadge = false subscription.notificationInfo = notificationInfo PublicDb.saveSubscription(subscription, completionHandler: { (returnedSubscription: CKSubscription!, error: NSError!) in println("\(error)") }) 

But I don’t have a field called "fieldID", and I don’t have a link to it in my whole project. I don’t know where 25 comes from. This happens if I change my record type and / or NSPredicate.

I also tried to fix this, but nothing

 notificationInfo.shouldSendContentAvailable = true 

This worked for me, but now I can no longer work. It looks like my database is messed up somewhere. I tried to delete the record type and recreate, but no luck.

+6
source share
2 answers

Fix this by resetting the development environment. Hope the same thing doesn't happen on prod. enter image description here

+7
source

The same thing happened to me. I do not think that fieldID belongs to any other database, but rather is part of the Apples database structure. Unfortunately, this reading gives developers zero information. Resetting the development environment also fixed my problem. It is worth noting that this happened after changing the attribute type of the record that was specifically indicated in the subscription. I saved the attribute name, but changed its type.

+4
source

Source: https://habr.com/ru/post/983716/


All Articles