NSPersistentCloudKitContainer CoreData & CloudKit Sync Crash

I am using the new iOS 13 NSPersistentCloudKitContainer for Syncing CoreData with iCloud.

For large size binary data i am using "Allow External Storage" in Core Data Model.


• I successfully added 200MB sized video on one device.

• It got synced to iCloud successfully.

• On the other device, when i am opening the App, it is receiving the CloudKit record, but somehow not able to work properly.

There is no programming error from my end. I have made sure that in CoreData Model "Allow External Storage" is selected.


Looks like it has something to do with how NSPersistentCloudKitContainer imports the large binary data.


Error

error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x2805386c0> , *** NSAllocateMemoryPages(227428466) failed with userInfo of (null)

CoreData: error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x2805386c0> , *** NSAllocateMemoryPages(227428466) failed with userInfo of (null)

2020-01-18 20:52:24.924003+0530 AppName[30450:5784098] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** NSAllocateMemoryPages(227428466) failed'


Other than this error, everything seems to work pretty well. Great job on the NSPersistentCloudKitContainer. Thanks Apple Developer Team.


Please help

Thank you so much

Maulik Sutariya

iOS Developer

I tried that using a 8k image, and it crashed as you said.
If I deselect the "Allow External Storage" option though, it works fine.

Wow, I've been chasing this crash for some time and deselecting "Allow External Storage" made it go away.

Thanks for the reply with the "fix".
NSPersistentCloudKitContainer CoreData &amp; CloudKit Sync Crash
 
 
Q