我遇到的问题是,当我通过Xcode运行我的应用程序运行正常但是当我手动启动它时崩溃了。我已经在SO上发了很多帖子,但我找不到任何具体的答案。我检查了设备日志,这是一个我认为是导致崩溃的片段:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000180ff5b9c objc_msgSend +28
1 AppSupport 0x0000000183159f0c _updateDetachedRecord + 32
2 AppSupport 0x0000000183159ffc CPRecordGetProperty + 52
3 AppSupport 0x000000018315a270 CPRecordCopyProperty + 24
4 AddressBook 0x0000000187774498 ABRecordCopyValueUnfiltered + 68
5 AddressBook 0x00000001877743bc ABRecordCopyValue + 68
我正在尝试访问我的地址簿并获取联系人详细信息(无论用户点击哪个),然后将其显示在弹出窗口中。以下是代码片段:
NSString *firstName = (__bridge NSString *) ABRecordCopyValue(person, kABPersonFirstNameProperty);
NSString *lastName = (__bridge NSString *) ABRecordCopyValue(person, kABPersonLastNameProperty);
NSString *company = (__bridge NSString *) ABRecordCopyValue(person, kABPersonOrganizationProperty);
NSString *title = (__bridge NSString *) ABRecordCopyValue(person, kABPersonPrefixProperty);
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
NSString *email = (__bridge NSString *)(ABMultiValueCopyValueAtIndex(emails, 0));
ABMultiValueRef phoneNo = ABRecordCopyValue(person, kABPersonPhoneProperty);
NSString *phnNo = (__bridge NSString *)(ABMultiValueCopyValueAtIndex(phoneNo, 0));
ABMultiValueRef skyepeIDs = ABRecordCopyValue(person, kABPersonInstantMessageProperty);
NSDictionary *skyepeID = (__bridge NSDictionary *)(ABMultiValueCopyValueAtIndex(skyepeIDs, 0));
P.S:当我通过Xcode运行时,应用程序运行完全正常。