“[EKObjectID entityName]”崩溃

时间:2013-12-09 20:38:23

标签: ios ios7 crash eventkit

我们在野外遇到了这种崩溃,当然我们无法在当地进行回购。它似乎只发生在ios 7上。它是一个NSInternalInconsistencyException的事实告诉我们它是一个内部的NSAssertion错误。任何想要防止这种情况发生的想法都将不胜感激。

这是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

1 个答案:

答案 0 :(得分:2)

这个错误的原因似乎与我们试图在我们的应用中获得的事件有多少有关。以下是我对苹果公司的错误报告(15424747)的回复。

当我们的应用程序在具有大范围日期的eventStore上做出谓词时,会出现此错误。这是代码:

NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate   endDate:endDate calendars:nil]; 
if (!self.masterListSortDescriptor) {    
    self.masterListSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"startDate" ascending:YES]; 
}
NSArray *result = [[self.eventStore eventsMatchingPredicate:predicate] sortedArrayUsingDescriptors:@[self.masterListSortDescriptor]];

如果startDate =今天 - 1年且结束日期=今天+ 2年,则此代码块将失败。我们已经解决了#34;这个问题是缩小范围到startDate =今天 - 6个月和结束日期=今天+ 1年,这个错误从我们的崩溃日志中消失。