CloudKit Push Notifications Intermittent

So yesterday, I was having a problem getting push notifications for my CloudKit app I'm working on in my development environment.

Then for some reason, this morning, I started receiving push notifications again. Now during testing, pushes have suddenly stopped. I have an iPhone and an iPad here and I'm testing on both devices.

I see there are lots of threads similar to this when I searched but was unable to find one that had a suitable answer. Here's my configuration:

1) My app only uses the private database and is using a custom zone.
2) I'm using a CKRecordZoneSubscription for silent pushes.
shouldSendContentAvailable is set to YES.



After making changes on one device, the other device gets the push. Then suddenly pushes stop working. Both apps are connected on the same wifi.


As I'm typing this, I finally just got a push for a small change on one record probably 10 minutes after it happened on the other device. The delay seems very poor.

I'd expect syncing to work a little better than this, not sure if this is just in the development environment?


Just had around a 10 minute delay before iPad changes made it over to the iPhone. Is this just how it is or is there anything I can do? Delay seems pretty long here. If the app was in the background would be okay, but it is in the foreground.

I really don't want hit the server on a timer.
I think I might have tracked the issue down.

I have my own asynchronous operation that wraps a CKModifyRecordsOperation inside of it. This is for a single record, so I assumed I could handle the error in the perRecordCompletionBlock or if there's no error to handle...post the KVO notifications for my operation for isExecuting and isFinished.

I had assumed, that the perRecordCompletionBlock would always be called. But that is not the case for some reason. If I get the following error:

 "Network Failure" (4/NSURLErrorDomain:-1001); "The request timed out.">

The per record completion block is *never* called and the error must be handled in the modifyRecordsCompletionBlock. So I had an operation basically that never finished (because the perRecordCompletionBlock was never called) and my operation never posted KVO notifications for isExecuting and isFinished and it blocked my queue (which has a maxConcurrentOperationCount set to 1). And syncing stopped working because my queue was blocked. Heh.

So long story short, perRecordCompletionBlock may not always be called for this kind of error as of iOS 13...are errors that skip the perRecordCompletionBlock documented anywhere?
CloudKit Push Notifications Intermittent
 
 
Q