ABPeoplePicker 仅针对一个人崩溃

发布于 2024-10-06 20:03:20 字数 6547 浏览 0 评论 0原文

我有一个应用程序,仅对我的一位测试人员崩溃,而对其他测试人员则不会崩溃。但对她来说,它总是崩溃。这很奇怪。

详情:
她拥有 iPhone 4 和 iPhone 3Gs
该应用程序在两部手机的所有操作系统上都会崩溃
无论联系人是如何创建的,应用程序都会崩溃
当她向我发送她的联系人信息时,它们在我的 iPhone 4 和 3G(不是 s)上都可以正常工作
她是唯一一个发生过崩溃的人,并且在所有手机和所有操作系统上都是一致的
她已卸载并重新安装该应用程序和配置文件
她正在将她的 iPhone 与 Windows 机器版本的 iTunes 同步。

当我们使用 ABPeoplePicker 时,会发生崩溃。
从她的角度来看,似乎在她选择电话号码的那一刻,应用程序就崩溃了。 当然,她当时不在我们的应用程序中。她位于 Apple 提供的 ABPeoplePicker 导航视图中。 从重新符号化的崩溃日志来看,在我看来,它在尝试返回我们的应用程序时实际上崩溃了。换句话说,我在崩溃日志中找不到任何提及我们的应用程序实际上对崩溃负责的内容(见下文)。 看起来它无法获取所选电话号码的索引,然后在尝试弹回我们的应用程序时失败,但这充其量只是猜测。 我已经阅读了苹果文档并尝试尽职调查学习如何阅读崩溃日志,但我仍然感到困惑。 这是我的问题:
1. 有谁知道异常代码:0x00000000、0x00000000 是什么意思?
2. 我假设第 9 行是实际问题所在,这是否正确?如果是这样,我如何理解 objc_exception_throw + 64 的含义?
3. 谁能解释一下这个崩溃日志所说的问题是什么?

Incident Identifier: 
CrashReporter Key:   
Hardware Model:      iPhone3,1
Process:         My App [471]
Path:            
Identifier:      My App
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2010-12-06 16:32:44.088 -0600
OS Version:      iPhone OS 4.0.2 (8A400)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib              0x000791d0 __kill + 8
1   libSystem.B.dylib              0x000791c0 kill + 4
2   libSystem.B.dylib              0x000791b2 raise + 10
3   libSystem.B.dylib              0x0008d6fa abort + 50
4   libstdc++.6.dylib              0x00044a20 __gnu_cxx::__verbose_terminate_handler() + 376
5   libobjc.A.dylib                0x000059ec _objc_terminate + 104
6   libstdc++.6.dylib              0x00042df2 __cxxabiv1::__terminate(void (*)()) + 46
7   libstdc++.6.dylib              0x00042e46 std::terminate() + 10
8   libstdc++.6.dylib              0x00042f16 __cxa_throw + 78
9   libobjc.A.dylib                0x000048cc objc_exception_throw + 64
10  CoreFoundation                 0x0001fb72 -[__NSArrayI objectAtIndex:] + 154
11  My App                  0x00005a68 0x1000 + 19048
12  My App                  0x00005dec 0x1000 + 19948
13  UIKit                          0x000668f4 -[UIViewController view] + 104
14  UIKit                          0x000784e4 -[UIViewController contentScrollView] + 16
15  UIKit                          0x00078354 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 24
16  UIKit                          0x00078252 -[UINavigationController _layoutViewController:] + 18
17  UIKit                          0x00077d58 -[UINavigationController _startTransition:fromViewController:toViewController:] + 372
18  UIKit                          0x00077b68 -[UINavigationController _startDeferredTransitionIfNeeded] + 176
19  UIKit                          0x00066fa8 -[UINavigationController pushViewController:transition:forceImmediate:] + 600
20  UIKit                          0x00066d40 -[UINavigationController pushViewController:animated:] + 28
21  My App                  0x0000a29a 0x1000 + 37530
22  My App                  0x0000bcba 0x1000 + 44218
23  AddressBookUI                  0x00032cfc -[ABPeoplePickerNavigationController personViewController:shouldPerformDefaultActionForPerson:property:identifier:withMemberCell:] + 152
24  AddressBookUI                  0x0003b8ce -[ABPersonViewControllerHelper personTableViewDataSource:selectedPropertyAtIndex:inPropertyGroup:withMemberCell:forEditing:] + 222
25  AddressBookUI                  0x0004a17c -[ABPersonTableViewDataSource valueAtIndex:selectedForPropertyGroup:withMemberCell:forEditing:] + 40
26  AddressBookUI                  0x00048c00 -[ABPersonTableViewDataSource tableView:didSelectRowAtIndexPath:] + 316
27  UIKit                          0x00091f40 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 656
28  UIKit                          0x0009db40 -[UITableView _userSelectRowAtIndexPath:] + 124
29  Foundation                     0x00086c86 __NSFireDelayedPerform + 362
30  CoreFoundation                 0x00071a54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
31  CoreFoundation                 0x00073ede __CFRunLoopDoTimer + 854
32  CoreFoundation                 0x0007485e __CFRunLoopRun + 1082
33  CoreFoundation                 0x0001d8e4 CFRunLoopRunSpecific + 224
34  CoreFoundation                 0x0001d7ec CFRunLoopRunInMode + 52
35  GraphicsServices               0x000036e8 GSEventRunModal + 108
36  GraphicsServices               0x00003794 GSEventRun + 56
37  UIKit                          0x000062a0 -[UIApplication _run] + 396
38  UIKit                          0x00004e10 UIApplicationMain + 664
39  My App                  0x0000d694 0x1000 + 50836
40  My App                  0x00002d00 0x1000 + 7424

这是我的 ABPeoplePicker 代码。

#pragma mark ABPeoplePickerNavigationControllerDelegate methods
// Displays the information of a selected person
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
    return YES;
}

// Does not allow users to perform default actions such as dialing a phone number, when they select a person property.
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker 
    shouldContinueAfterSelectingPerson:(ABRecordRef)person 
                 property:(ABPropertyID)property 
                                  identifier:(ABMultiValueIdentifier)identifier {

     CFStringRef cfName = ABRecordCopyCompositeName(person);
     self.selectedName = [NSString stringWithString:(NSString *)cfName];
     CFRelease(cfName);

     ABMultiValueRef allThePhoneNums = ABRecordCopyValue(person, kABPersonPhoneProperty);

     // ABMultiValueGetIndexForIdentifier the exact value of the "identifier" passed to us.
     NSString *number = (NSString *)ABMultiValueCopyValueAtIndex(allThePhoneNums, ABMultiValueGetIndexForIdentifier(allThePhoneNums, identifier));

     self.selectedNumber = number;

     [number release];

     CFRelease(allThePhoneNums);

     [self showDialOutToPartViewControllerWithName:self.selectedName andNumber:self.selectedNumber];

     [peoplePicker dismissModalViewControllerAnimated:YES];

     return NO;
 }


 // Dismisses the people picker and shows the application when users tap Cancel. 
 - (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker; {
     [self dismissModalViewControllerAnimated:YES];
 }

I have an app that only crashes for one of my tester’s - no one else’s. But it crashes consistently for her. It’s very odd.

Details:
She has in iPhone 4 and an iPhone 3Gs
The app crashes on all OSes on BOTH phones
The app crashes with all contacts no matter how they were created
When she sends me her contacts they work fine on both my iPHone 4 and my 3G (not s)
She is the ONLY one that ever gets a crash and it is consistent across both phones and all OSes
She has uninstalled and reinstalled the app and the provisioning profile
She is syncing her iPhone with a windows machine version of iTunes

The crash happens when we use ABPeoplePicker.
From her perspective it looks like the minute she selects a phone number the app crashes.
Of course she is not in our app at that moment. She is in the ABPeoplePicker navigation view provided by Apple.
From the resymbolicated crash log it looks to me like it’s actually crashing when it is trying to return to our app. In other words I can’t find any mention of our app actually being responsible for the crash in the crash log (see below).
It looks like it’s not able to get the index of the selected phone number and then fails when trying to pop back into our app but that’s a guess at best.
I have read the Apple docs and tried to do due diligence in learning about how to read crash logs but I am still stumped.
Here are my questions:
1. Does anyone know what Exception Codes: 0x00000000, 0x00000000 means?
2. Am I correct in assuming that line 9 is where the actual issues is referred to? And if so how do I understand what objc_exception_throw + 64 means?
3. Can anyone shed some light on what this crash log says the problem is?

Incident Identifier: 
CrashReporter Key:   
Hardware Model:      iPhone3,1
Process:         My App [471]
Path:            
Identifier:      My App
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2010-12-06 16:32:44.088 -0600
OS Version:      iPhone OS 4.0.2 (8A400)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib              0x000791d0 __kill + 8
1   libSystem.B.dylib              0x000791c0 kill + 4
2   libSystem.B.dylib              0x000791b2 raise + 10
3   libSystem.B.dylib              0x0008d6fa abort + 50
4   libstdc++.6.dylib              0x00044a20 __gnu_cxx::__verbose_terminate_handler() + 376
5   libobjc.A.dylib                0x000059ec _objc_terminate + 104
6   libstdc++.6.dylib              0x00042df2 __cxxabiv1::__terminate(void (*)()) + 46
7   libstdc++.6.dylib              0x00042e46 std::terminate() + 10
8   libstdc++.6.dylib              0x00042f16 __cxa_throw + 78
9   libobjc.A.dylib                0x000048cc objc_exception_throw + 64
10  CoreFoundation                 0x0001fb72 -[__NSArrayI objectAtIndex:] + 154
11  My App                  0x00005a68 0x1000 + 19048
12  My App                  0x00005dec 0x1000 + 19948
13  UIKit                          0x000668f4 -[UIViewController view] + 104
14  UIKit                          0x000784e4 -[UIViewController contentScrollView] + 16
15  UIKit                          0x00078354 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 24
16  UIKit                          0x00078252 -[UINavigationController _layoutViewController:] + 18
17  UIKit                          0x00077d58 -[UINavigationController _startTransition:fromViewController:toViewController:] + 372
18  UIKit                          0x00077b68 -[UINavigationController _startDeferredTransitionIfNeeded] + 176
19  UIKit                          0x00066fa8 -[UINavigationController pushViewController:transition:forceImmediate:] + 600
20  UIKit                          0x00066d40 -[UINavigationController pushViewController:animated:] + 28
21  My App                  0x0000a29a 0x1000 + 37530
22  My App                  0x0000bcba 0x1000 + 44218
23  AddressBookUI                  0x00032cfc -[ABPeoplePickerNavigationController personViewController:shouldPerformDefaultActionForPerson:property:identifier:withMemberCell:] + 152
24  AddressBookUI                  0x0003b8ce -[ABPersonViewControllerHelper personTableViewDataSource:selectedPropertyAtIndex:inPropertyGroup:withMemberCell:forEditing:] + 222
25  AddressBookUI                  0x0004a17c -[ABPersonTableViewDataSource valueAtIndex:selectedForPropertyGroup:withMemberCell:forEditing:] + 40
26  AddressBookUI                  0x00048c00 -[ABPersonTableViewDataSource tableView:didSelectRowAtIndexPath:] + 316
27  UIKit                          0x00091f40 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 656
28  UIKit                          0x0009db40 -[UITableView _userSelectRowAtIndexPath:] + 124
29  Foundation                     0x00086c86 __NSFireDelayedPerform + 362
30  CoreFoundation                 0x00071a54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
31  CoreFoundation                 0x00073ede __CFRunLoopDoTimer + 854
32  CoreFoundation                 0x0007485e __CFRunLoopRun + 1082
33  CoreFoundation                 0x0001d8e4 CFRunLoopRunSpecific + 224
34  CoreFoundation                 0x0001d7ec CFRunLoopRunInMode + 52
35  GraphicsServices               0x000036e8 GSEventRunModal + 108
36  GraphicsServices               0x00003794 GSEventRun + 56
37  UIKit                          0x000062a0 -[UIApplication _run] + 396
38  UIKit                          0x00004e10 UIApplicationMain + 664
39  My App                  0x0000d694 0x1000 + 50836
40  My App                  0x00002d00 0x1000 + 7424

Here is my ABPeoplePicker code.

#pragma mark ABPeoplePickerNavigationControllerDelegate methods
// Displays the information of a selected person
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
    return YES;
}

// Does not allow users to perform default actions such as dialing a phone number, when they select a person property.
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker 
    shouldContinueAfterSelectingPerson:(ABRecordRef)person 
                 property:(ABPropertyID)property 
                                  identifier:(ABMultiValueIdentifier)identifier {

     CFStringRef cfName = ABRecordCopyCompositeName(person);
     self.selectedName = [NSString stringWithString:(NSString *)cfName];
     CFRelease(cfName);

     ABMultiValueRef allThePhoneNums = ABRecordCopyValue(person, kABPersonPhoneProperty);

     // ABMultiValueGetIndexForIdentifier the exact value of the "identifier" passed to us.
     NSString *number = (NSString *)ABMultiValueCopyValueAtIndex(allThePhoneNums, ABMultiValueGetIndexForIdentifier(allThePhoneNums, identifier));

     self.selectedNumber = number;

     [number release];

     CFRelease(allThePhoneNums);

     [self showDialOutToPartViewControllerWithName:self.selectedName andNumber:self.selectedNumber];

     [peoplePicker dismissModalViewControllerAnimated:YES];

     return NO;
 }


 // Dismisses the people picker and shows the application when users tap Cancel. 
 - (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker; {
     [self dismissModalViewControllerAnimated:YES];
 }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱娆 2024-10-13 20:03:20

最重要的是,它有助于使用 symbolicatecrash 工具和编译时生成的 DSYM 文件对崩溃日志进行符号化。我不会在这里讨论如何做到这一点——你可以搜索谷歌找到更多细节;尝试“符号崩溃日志 DSYM”作为关键字。

一旦你这样做了,而不是:

My App      0x0232032+433

它会显示类似这样的内容:

My App      [className callSomeMethod:argument]

更容易找到产生问题的代码行。

但是 - 请注意堆栈跟踪中的最后一行代码是 Foundation 中的 [array objectAtIndex:]。当您传递超出接收器范围(例如数组)的索引时,此方法将抛出NSRangeException。来自 NSArray 文档:

如果索引超出了末尾
数组(也就是说,如果索引大于
大于或等于返回的值
count),会引发 NSRangeException。

所以,我会把我的钱押在你的崩溃上。

那么问题是 - 在符号化崩溃日志之后 - 哪一行代码正在调用具有越界索引的数组?

Foremost, it helps to symbolicate your crash logs using the symbolicatecrash tool and the DSYM file that was generated when you compiled it. I won't discuss how to do that here -- you can search Google to find more details; try "symbolicate crash log DSYM" as keywords.

Once you do that, instead of:

My App      0x0232032+433

It will show something like this:

My App      [className callSomeMethod:argument]

Much easier to find the line of code that is spawning the problem.

However - note in the stack trace that the last line of code is [array objectAtIndex:] in Foundation. This method will throw an NSRangeException when you pass an index outside of the bounds of the receiver (e.g. array). From the NSArray docs:

If index is beyond the end of the
array (that is, if index is greater
than or equal to the value returned by
count), an NSRangeException is raised.

So, I'd put my money on that being your crash.

Then the question is - after you symbolicate your crash log - what line of your code is calling an array with an out-of-bounds index?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文