Post

Replies

Boosts

Views

Created

Batch insert error when unique constraint is set on multiple attributes
I'm testing out Core Data batch insert. The performance is amazing!! Data gets imported in a just a couple hundreds of milliseconds. New rows are inserted and existing rows are updated. I ran into 1 problem though.... If the unique constraint is set with multiple attributes, batch insert will fail. Below is the call stack of the failed operation: 2020-10-06 00:05:44.900901-0700 TestHostingApp[17605:1541912] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'error in batch insertion: Error Domain=NSCocoaErrorDomain Code=134050 "(null)" UserInfo={NSExceptionOmitCallstacks=true, _NSCoreDataOptimisticLockingFailureConflictsKey=()}' \*\*\* First throw call stack: ( 0   CoreFoundation                      0x00007fff2043a126 __exceptionPreprocess + 242 1   libobjc.A.dylib                     0x00007fff20177f78 objc_exception_throw + 48 2   CoreFoundation                      0x00007fff20439f4f +[NSException raise:format:] + 0 3   Foundation                          0x00007fff207881ca -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191 4   SchedKit2_Tests                     0x0000000104fb85a7 -[NSManagedObjectContext(SchedBatchInsert) batchInsertWithEntityName:objects:] + 391 5   SchedKit2_Tests                     0x0000000104fb3194 __92+[BatchImport importEntityWithName:confID:batchSize:context:queue:formatHandler:completion:]_block_invoke_2.73 + 180 6   CoreData                            0x00007fff25109933 developerSubmittedBlockToNSManagedObjectContextPerform + 154 7   libdispatch.dylib                   0x00007fff20106534 _dispatch_client_callout + 8 8   libdispatch.dylib                   0x00007fff2010c425 _dispatch_lane_serial_drain + 715 9   libdispatch.dylib                   0x00007fff2010cfa0 _dispatch_lane_invoke + 403 10  libdispatch.dylib                   0x00007fff20117591 _dispatch_workloop_worker_thread + 782 11  libsystem_pthread.dylib             0x00007fff5dcd8a3d _pthread_wqthread + 290 12  libsystem_pthread.dylib             0x00007fff5dcd7b77 start_wqthread + 15 ) libc++abi.dylib: terminating with uncaught exception of type NSException My entity has this constrain configuration: Constraints: eventID,sessionID The context where batch insert operation has mergeByPropertyObjectTrumpMergePolicy policy set. Is this a known limitation? (i.e. I can only set unique constraint on 1 attribute in order to have batch insert work correctly?)
3
0
1.6k
Oct ’20
Batch insert error when unique constraint is set on multiple attributes
I'm testing out Core Data batch insert. The performance is amazing!! Data gets imported in a just a couple hundreds of milliseconds. New rows are inserted and existing rows are updated. I ran into 1 problem though.... If the unique constraint is set with multiple attributes, batch insert will fail. Below is the call stack of the failed operation: 2020-10-06 00:05:44.900901-0700 TestHostingApp[17605:1541912] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'error in batch insertion: Error Domain=NSCocoaErrorDomain Code=134050 "(null)" UserInfo={NSExceptionOmitCallstacks=true, _NSCoreDataOptimisticLockingFailureConflictsKey=()}' \*\*\* First throw call stack: ( 0   CoreFoundation                      0x00007fff2043a126 __exceptionPreprocess + 242 1   libobjc.A.dylib                     0x00007fff20177f78 objc_exception_throw + 48 2   CoreFoundation                      0x00007fff20439f4f +[NSException raise:format:] + 0 3   Foundation                          0x00007fff207881ca -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191 4   SchedKit2_Tests                     0x0000000104fb85a7 -[NSManagedObjectContext(SchedBatchInsert) batchInsertWithEntityName:objects:] + 391 5   SchedKit2_Tests                     0x0000000104fb3194 __92+[BatchImport importEntityWithName:confID:batchSize:context:queue:formatHandler:completion:]_block_invoke_2.73 + 180 6   CoreData                            0x00007fff25109933 developerSubmittedBlockToNSManagedObjectContextPerform + 154 7   libdispatch.dylib                   0x00007fff20106534 _dispatch_client_callout + 8 8   libdispatch.dylib                   0x00007fff2010c425 _dispatch_lane_serial_drain + 715 9   libdispatch.dylib                   0x00007fff2010cfa0 _dispatch_lane_invoke + 403 10  libdispatch.dylib                   0x00007fff20117591 _dispatch_workloop_worker_thread + 782 11  libsystem_pthread.dylib             0x00007fff5dcd8a3d _pthread_wqthread + 290 12  libsystem_pthread.dylib             0x00007fff5dcd7b77 start_wqthread + 15 ) libc++abi.dylib: terminating with uncaught exception of type NSException My entity has this constrain configuration: Constraints: eventID,sessionID The context where batch insert operation has mergeByPropertyObjectTrumpMergePolicy policy set. Is this a known limitation? (i.e. I can only set unique constraint on 1 attribute in order to have batch insert work correctly?)
Replies
3
Boosts
0
Views
1.6k
Activity
Oct ’20
"Sign in with Apple" for apps with different Team ID
Question about "Sign in with Apple". Can 2 apps from 2 different developer accounts (hence, 2 different team ID) share authentications? In other words, can I get consistent user ID from 2 different app under 2 different developer account? Is there a way to configure that from developer portal? Thanks Bill
Replies
1
Boosts
0
Views
994
Activity
Mar ’24
Swift Playgrounds 4.5.1 creating new book with Swift 5.9?
Hi all! I am using Swift Playgrounds 4.5.1 on Mac and iPad. When I create new book, they both create new book with Swift 5.9 (instead of Swift 5.10). Is this a bug? The release notes says since 4.5.0 the Swift version has been upgraded to 5.10. Thanks B
Replies
1
Boosts
0
Views
938
Activity
Jul ’24