我正在爲CloudKit編寫初始化方法。提取用戶ID /帳戶狀態時出現問題。我的電話是[[CKContainer defaultContainer] fetchUserRecordIDWithCompletionHandler:]
。iOS CloudKit崩潰完成塊for -fetchUserRecordIDWithCompletionHandler:
它稍後崩潰,調試器將我指向「Queue:com.apple.cloudkit.operation.callback(serial)queue」線程。
此方法是具有應執行的回調的唯一CloudKit相關方法。
這裏的方法本身:
[[CKContainer defaultContainer] fetchUserRecordIDWithCompletionHandler:^(CKRecordID *recordID, NSError *error) {
NSLog(@"CLOUDKIT Fetching User Record ID");
if (error) {
NSLog(@"[%@] Error loading CloudKit user: %@", self.class, error);
}
if (recordID) {
NSLog(@"CLOUDKIT Found User Record ID: %@", recordID.recordName);
// If there is a record ID we check for account status
[[CKContainer defaultContainer] accountStatusWithCompletionHandler:^(CKAccountStatus accountStatus, NSError *error) {
NSLog(@"CLOUDKIT Finding Account Status");
if (error) {
NSLog(@"[%@] Error checking CloudKit availability: %@", self.class, error);
}
if (accountStatus == CKAccountStatusAvailable) {
NSLog(@"CLOUDKIT Account Available, beginning initial sync");
// We have an available account. If we have a new user do a complete sync
NSString *userRecordID = [[NSUserDefaults standardUserDefaults] stringForKey:CLOUD_KIT_CURRENT_USER_ID_USER_DEFAULT];
if (userRecordID == nil || ![recordID.recordName isEqualToString:userRecordID]){
[self syncAllData];
} else {
// If there haven't been any updates, just sync as usual
[self syncChanges];
}
// Subscribe to zone updates
[self subscribeToDefaultZoneUpdates];
} else {
NSLog(@"[%@] Cloudkit account is either unavailable or restricted", self.class);
}
}];
} else {
NSLog(@"[%@] CloudKit user Record ID not found", self.class);
}
}];
有這個前後正在執行,但NSLog的最頂部(「CLOUDKIT獲取用戶記錄ID」)永遠不會被執行NSLogs。
當它崩潰的日誌不給我任何信息。下面是從Xcode的線程隊列:
下面是它實際上在調試導航吐出來。
libsystem_kernel.dylib`__pthread_kill:
0x332f7df4: mov r12, #0x148
0x332f7df8: svc #0x80
0x332f7dfc: blo 0x332f7e14 ; __pthread_kill + 32
0x332f7e00: ldr r12, [pc, #4] ; __pthread_kill + 24
0x332f7e04: ldr r12, [pc, r12]
0x332f7e08: b 0x332f7e10 ; __pthread_kill + 28
0x332f7e0c: rsbeq lr, r6, #0x80000001
0x332f7e10: bx r12
0x332f7e14: bx lr
具體來說,它是打破在0x332f7dfc: blo 0x332f7e14 ; __pthread_kill + 32
你真的崩潰了嗎?意思是,如果你在調試器中點擊「繼續」,你會繼續嗎?你有沒有嘗試擊中它,直到發生什麼事情?您是否啓用了「所有例外」斷點?你打破了哪條特定路線?有時,蘋果的API會出於任何原因拋出非致命的異常,我已經在AVAudioPlayer上看到過它。 – 2014-08-29 22:47:46
點擊繼續不會給我任何新信息。它只是吐出更多的裝配,直到我陷入困境。它不給我一個行號。休息時間在調試導航器中。 – Jonathan 2014-08-29 22:58:24
它實際上是打破看起來像這樣一點: libsystem_kernel.dylib'__pthread_kill: 0x332f7df4:MOV R12,#0x148 0x332f7df8:SVC#0x80的 0x332f7dfc:BLO 0x332f7e14; __pthread_kill + 32 0x332f7e00:ldr r12,[pc,#4]; __pthread_kill + 24 0x332f7e04:ldr r12,[pc,r12] 0x332f7e08:b 0x332f7e10; __pthread_kill + 28 0x332f7e0c:rsbeq lr,r6,#0x80000001 0x332f7e10:bx r12 0x332f7e14:bx lr – Jonathan 2014-08-29 22:58:45