We've been getting this kind of crash in the wild and of course we can't repo it locally. it seems like it's only happening on ios 7. The fact that it is a NSInternalInconsistencyException tell us that it is a internal NSAssertion error. Any idea to prevent this from happening would be greatly appreciated.
here is the stacktrace:
Thread : Fatal Exception: NSInternalInconsistencyException,
Unknown entity type while trying to create an object ID
0 CoreFoundation 0x2d69bf4b __exceptionPreprocess + 130
1 libobjc.A.dylib 0x37a2b6af objc_exception_throw + 38
2 CoreFoundation 0x2d69be25 +[NSException raise:format:]
3 Foundation 0x2e043fe3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 90
4 EventKit 0x2ddf2e2b -[EKObjectID entityName] + 202
5 EventKit 0x2ddf2c65 -[EKEventStore _addFetchedObjectWithID:] + 56
6 EventKit 0x2ddf2c0d __78-[EKEventStore registerFetchedObjectWithID:withDefaultLoadedProperties:inSet:]_block_invoke + 80
7 libdispatch.dylib 0x37f0ed07 _dispatch_client_callout + 22
8 libdispatch.dylib 0x37f20e73 _dispatch_barrier_sync_f_invoke + 26
9 EventKit 0x2ddf2b05 -[EKEventStore registerFetchedObjectWithID:withDefaultLoadedProperties:inSet:] + 156
10 EventKit 0x2ddfa371 __41-[EKPredicateSearch startWithCompletion:]_block_invoke + 652
11 EventKit 0x2ddfa001 -[EKDaemonConnection _processReplyWithID:data:finished:] + 264
12 EventKit 0x2ddf9ef3 CADReceiveReply + 98
13 EventKit 0x2ddf9e5f _XReply + 102
14 EventKit 0x2ddf9dd5 ClientCallbacks_server + 64
15 libdispatch.dylib 0x37f11a9d dispatch_mig_server$VARIANT$up + 312
16 EventKit 0x2ddf9d6d __43-[EKDaemonConnection initWithOptions:path:]_block_invoke16 + 40
17 libdispatch.dylib 0x37f0f057 _dispatch_source_invoke$VARIANT$up + 258
18 libdispatch.dylib 0x37f218f9 _dispatch_root_queue_drain + 76
19 libdispatch.dylib 0x37f21b79 _dispatch_worker_thread2 + 56
20 libsystem_pthread.dylib 0x38050dbf _pthread_wqthread + 298
21 libsystem_pthread.dylib 0x38050c84 start_wqthread + 8
It seems like the cause of this bug is related to how many events we are trying to get in our app. Here is my reply on the apple's bug report (15424747).
It appears that this bug is introduced when our app does predicate on the eventStore with a large range of dates. Here is the code:
This block of code will failed if startDate = Today - 1 year and endDate = Today + 2 years. We "solved" this issue by shrinking the range to startDate = Today - 6 months and endDate = Today + 1 year and this bug disappear from our crash logs.