I am trying to test long-lived CKOperations in my CloudKit app. What seems to be happening is that, for my CKModifyRecordsOperation with longLived flag is Yes, the longLivedOperationWasPersistedBlock is being called correctly, but after quitting the app and then restarting it, the fetchAllLongLivedOperationIDsWithCompletionHandler doesn't return any operationIDs, even though if I save the operationID manually and then fetch using fetchLongLivedOperationWithID, it returns a valid operation that shows that it is "outstanding":
<CKModifyRecordsOperation: 0x101d0e340; operationID=5D9A254E4C3E3C41, long-lived, outstanding, qos=UserInteractive>
I have tried a couple of different things:
- I set a breakpoint in perRecordCompletionBlock, verify that it is called after longLivedOperationWasPersistedBlock completes (but before modifyRecordsCompletionBlock), and then kill the debugger at that point
- I set the same breakpoints, but instea dof killing debugger, I close the app by swiping up on the app-switcher screen
- I've tried without the debugger, just used the app to upload something large (8MB) and quit, and then restarted with the debugger
None of these seems to work. Any ideas why? The only detail I am aware of is that fetchAllLongLivedOperationIDsWithCompletionHandler shiould be called, which it is!
Thanks.