NSPersistentCloudKitContainer error handling - ios

Sometimes an NSPersistentCloudKitContainer will report an error in the console like so:
*2020-04-14 16:41:27.725794+0100 ExampleApp[9736:8226377] [error] error: CoreData+CloudKit: -: <NSCloudKitMirroringDelegate: 0x282b944d0>: Sending ‘NSCloudKitMirroringDelegateWillResetSyncNotificationName’ with reason: ‘UserPurgedZone’* [NSCloudKitMirroringDelegate logResetSyncNotification:](1798)
In my code I have error handling in the loading of the persistent store but this error doesn't trigger it as this error comes after the store has loaded.
Where do I handle these errors? How can I see these errors in code?

Related

Xcode Crash due to Persistance container in swift

I'm currently making an app implementing core data. However, when I build, it crashes at this line:
Thread 1: Fatal error: Unresolved error Error
Domain=NSCocoaErrorDomain Code=134140 "Persistent store migration
failed, missing mapping model."
UserInfo={sourceModel=() isEditable
0, entities {
What does this mean? How can I solve this?

CoreData Error: Invalid generation token: this persistent store coordinator does not have any of the referenced stores

I'm unable to repro this error but my crash reporter indicates that it's fairly frequent among my users (iOS 12):
Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=134060 "A Core Data error occurred." UserInfo={Reason=Invalid generation token: this persistent store coordinator does not have any of the referenced stores}: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang_Fall2018/swiftlang_Fall2018-1000.11.42/src/swift/stdlib/public/core/ErrorType.swift, line 184
Crashing line example:
let result = try! self.syncContext.fetch(request)
I would like to decipher error message. Does Invalid generation token refers to NSQueryGenerationToken? Is the error part of conflict resolution process?

UIDocument save error: Could not get attribute values

I see this error in Xcode debug console when I call save(...) on my UIDocument, but it seems to have no effect on my app. Anyone know what causes it and how to stop it? I'm saving documents as a package with FileWrapper.
2018-08-12 10:24:12.818324-0400 MyApp[2694:1486251] [default] [ERROR]
Could not get attribute values for item /private/var/[...]/Documents/NewDoc.myextension (s).
Error: Error Domain=LocalStorageFileProvider.LocalFileProviderError Code=0 "(null)"

strict.lua - How do find out where the error occurred?

I am using strict.lua in a cocos2d-x project under Xcode. When I get an error it doesn't tell me where the error occurred. I just get an error message like:
cocos2d: LUA ERROR: attempt to call a number value
PANIC: unprotected error in call to Lua API (...<folder>/strict.lua:30: attempt to index a nil value)
How can I get strict.lua to tell me where the error occurred or give me a call stack?
(Note putting print(debug.traceback()) in strict.lua doesn't work)

iCloud fails with core data - partial updates - undocumented error message

I am trying to sync the data of a core data app between two devices via iCloud. It basically seems to work, but it mostly fails. Data does not show up, or shows up randomly / partially. Sync takes forever (sometimes: hours).
Of course I tried all obvious remedies such as deleting the apps and data from the devices etc.
I get the following messages (relevant excerpt):
[_PFUbiquityRecordsImporter operation:failedWithError:](839):
CoreData: Ubiquity: Import operation encountered an error:
Error Domain=NSCocoaErrorDomain
Code=134060 "The operation couldn’t be completed.
(Cocoa error 134060.)" UserInfo=0x1106a6a0
{exception=Attempted to perform an operation without an open database}
while trying to import the log file at the URL:
<PFUbiquityTransactionLog: 0x11062710>
right after
CoreData: Ubiquity: Error importing transaction log:
<PFUbiquityTransactionLog: 0x110eb820>
and later
-[_PFUbiquityRecordsImporter operation:failedWithError:](824):
CoreData: Ubiquity: Import operation encountered a corrupt log file,
Error Domain=NSCocoaErrorDomain Code=134302
"The operation couldn’t be completed. (Cocoa error 134302.)"
UserInfo=0x12e0b0 {underlyingError=Error Domain=NSCocoaErrorDomain Code=19
"The operation couldn’t be completed. (Cocoa error 19.)" UserInfo=0x1af070
{NSUnderlyingException=error during SQL execution : constraint failed,
NSFilePath=/var/mobile/Applications/
59087988-334C-40DC-9F6A-C7DA22F7B790/Documents/database.sqlite,
NSSQLiteErrorDomain=19}, reason=Error encountered while importing
transaction log at URL: <PFUbiquityTransactionLog: 0xe87b3f0>
Any clues about this "without an open database" error?
What to do about the "corrupt log file"?

Resources