2016-11-22 65 views
1

在我的基於日曆的應用程序中,我遇到了來自應用商店構建的大量崩潰。但是,我無法重現,也沒有面對這次開發的崩潰。如何調試和重現`NSOperationQueue`崩潰

崩潰日誌從面料:

-[EKEventStore(Utils) calendarByRetrievingSafelyWithIdentifier:forEntityType:] 

    Crashed: NSOperationQueue 0x17403fd60 :: NSOperation 0x17425bfc0 (QOS: DEFAULT) 
0 CoreFoundation     0x19179b5d8 -[__NSDictionaryM setObject:forKey:] + 476 
1 EventKit      0x19ab2a0d8 -[EKObject relationForKey:] + 216 
2 EventKit      0x19ab859d4 -[EKCalendar source] + 24 
3 EventKit      0x19ab9d718 -[EKEventStore calendarsForEntityType:] + 512 
4 SampleApp      0x100112554 -[EKEventStore(Utils) calendarByRetrievingSafelyWithIdentifier:forEntityType:] (MySampleCalendarStore.m:4767) 
5 SampleApp      0x1001d3f88 -[MyCalendarDataStore syncCalendarItems:startDate:endDate:completion:] (MyCalendarDataStore.m:84) 
6 SampleApp      0x1000f4e58 __62-[MySampleAppStore syncDeviceCalendarsAndItems:withCompletion:]_block_invoke.1043 (MySampleCalendarStore.m:2499) 
7 Foundation      0x19237e754 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16 
8 Foundation      0x1922c32c8 -[NSBlockOperation main] + 96 
9 Foundation      0x1922b38c4 -[__NSOperationInternal _start:] + 620 
10 Foundation      0x192380b00 __NSOQSchedule_f + 228 
11 libdispatch.dylib    0x1907451c0 _dispatch_client_callout + 16 
12 libdispatch.dylib    0x190753444 _dispatch_queue_serial_drain + 928 
13 libdispatch.dylib    0x1907489a8 _dispatch_queue_invoke + 652 
14 libdispatch.dylib    0x19075538c _dispatch_root_queue_drain + 572 
15 libdispatch.dylib    0x1907550ec _dispatch_worker_thread3 + 124 
16 libsystem_pthread.dylib  0x19094e2b8 _pthread_wqthread + 1288 
17 libsystem_pthread.dylib  0x19094dda4 start_wqthread + 4 

我想解決這個問題的碰撞,我過去的一週試圖與所有論壇。我無法得到任何有用的線索來解決我的問題。 請指導我手動重現這種類型的崩潰,並幫助解決。

我的代碼:

NSOperationQueue *calendarDataStoresQueue = [[NSOperationQueue alloc] init]; 
for (EKCalendar *calendar in calendars) { 
     [calendarDataStoresQueue addOperationWithBlock:^{ 
      MyCalendarDataStore *calendarDataStore = [[MyCalendarDataStore alloc] initWithCalendar:[[MYCalendar alloc] initWithInfoOfEventKitCalendar:calendar] eventStore:weakSelf.eventStore]; 
      [calendarDataStore syncCalendarItems:items startDate:syncFrom endDate:syncTo completion:^{ 
       complition() 
      }]; 
     }]; 
} 

我的utils的:

@implementation EKEventStore (Utils) 

- (EKCalendar*)calendarByRetrievingSafelyWithIdentifier:(NSString *)identifier forEntityType:(EKEntityType)entityType { 
    EKCalendar *calendar; 
    NSArray *calendars = [self calendarsForEntityType:entityType]; 
    for (EKCalendar *aCalendar in calendars) { 
     if([aCalendar.calendarIdentifier isEqualToString:identifier]) { 
      calendar = aCalendar; 
      break; 
     } 

    } 
    return calendar; 
} 
@end 

提前謝謝

+0

做你試過'異常斷點? –

+0

是的,我已檢查,仍然沒有運氣。 – Ammaiappan

回答

0

你沒有張貼足夠的信息;你的內部崩潰了 - [EKObject relationForKey:]方法;甚至更多,你沒有發佈你的崩潰的確切原因;

在我看來,這個方法[EKObject relationForKey:]從自身生成字典的地方,並可能是,[__NSDictionaryM的setObject:forKey:]在這裏,你嘗試插入零到字典

+0

請檢查崩潰日誌「3 EventKit 0x19ab9d718 - [EKEventStore calendarsForEntityType:] + 512」。我在我的問題中給出了這個代碼,之後都是eventKit框架函數。 – Ammaiappan

+0

是的,我已經做了'但它不包含必要的信息;你能發佈這個崩潰的布料頁面的截圖嗎? –

+0

請檢查崩潰日誌「3 EventKit 0x19ab9d718 - [EKEventStore calendarsForEntityType:] + 512」。我在我的問題中給出了這個代碼,在這之後都是eventKit框架函數 – Ammaiappan