问题
UPDATE notification stopped working. What workaround do you have, until Apple figures out something?
CKFetchNotificationChangesOperation sometimes does not return UPDATE, DELETE notifications CloudKit push notifications on record update stopped working https://forums.developer.apple.com/thread/7288
My quick fix, that in every minute, and when user triggers UIRefreshControl
, then I downloading all the records that were modified since the last update. It works. But I have a better idea in my mind, curious, what do you think. Any drawbacks.
I am thinking adding a Change
table to the database. It will have a recordName
, recordType
, changeType
fields. changeType
could have insert
, update
, delete
string values. (or int enumerations accordingly)
And I would create and observe with CKSubscription
only the Change
table. Always when a record is create, updated, deleted in a custom table, I would do two things, do that action and as a second action I would make a 'log entry' into the Change
table. Because it is an Insert
operation in Change
, and insert notification seems to work, all the device would get notified. They could download the refered record.
Do you see any drawbacks?
回答1:
I have used a similar strategy. There are some drawbacks:
- more data (storage and transfer) usage
- limited subscription possibilities or you have to duplicate even more data.
- extra code in your app that you actually don't want to be there.
The only good solution to this problem is:
- Apple should fix it...
来源:https://stackoverflow.com/questions/31499029/alternatives-to-update-notification-that-does-not-work