简体   繁体   English

ABPeoplePickerNavigationController在presentviewcontroller时崩溃

[英]ABPeoplePickerNavigationController crashed while presentviewcontroller

Some one help me to fix this crash issue. 有人可以帮助我解决此崩溃问题。 I am not able to get the root cause of it. 我无法找到它的根本原因。

ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
    [self presentViewController:picker animated:YES completion:nil];

And I am getting the below crash, not sure why, 我得到下面的崩溃,不知道为什么,

-[ABPeoplePickerNavigationController masterViewController]: unrecognized selector sent to instance 0xdd8cd40

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ABPeoplePickerNavigationController masterViewController]: unrecognized selector sent to instance 0xdd8cd40'
*** First throw call stack:
(
    0   CoreFoundation                      0x03b5e5e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x031f28b6 objc_exception_throw + 44
    2   CoreFoundation                      0x03bfb903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x03b4e90b ___forwarding___ + 1019
    4   CoreFoundation                      0x03b4e4ee _CF_forwarding_prep_0 + 14
    5   UIKit                               0x0271f544 -[UISearchDisplayController _areSearchContentsSplitViewMaster] + 63
    6   UIKit                               0x0271f6ac -[UISearchDisplayController _configureNewSearchBar] + 307
    7   UIKit                               0x0271ee63 -[UISearchDisplayController initWithSearchBar:contentsController:searchResultsTableViewStyle:] + 121
    8   UIKit                               0x0271ede5 -[UISearchDisplayController initWithSearchBar:contentsController:] + 55
    9   AddressBookUI                       0x03dffe5e -[ABMembersController contentView] + 1223
    10  AddressBookUI                       0x03e05d3e -[ABMembersViewController updateView] + 57
    11  AddressBookUI                       0x03e058b0 -[ABMembersViewController loadView] + 36
    12  UIKit                               0x0249d73e -[UIViewController loadViewIfRequired] + 78
    13  UIKit                               0x024c31a5 -[UINavigationController _layoutViewController:] + 39
    14  UIKit                               0x024c36bb -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 235
    15  UIKit                               0x024c37b3 -[UINavigationController _startTransition:fromViewController:toViewController:] + 78
    16  UIKit                               0x024c472c -[UINavigationController _startDeferredTransitionIfNeeded:] + 645
    17  UIKit                               0x024c5349 -[UINavigationController __viewWillLayoutSubviews] + 57
    18  UIKit                               0x025fe39d -[UILayoutContainerView layoutSubviews] + 213
    19  UIKit                               0x024c1592 __53-[UINavigationController setNeedsDeferredTransition:]_block_invoke + 45
    20  UIKit                               0x023a6d33 ___afterCACommitHandler_block_invoke + 15
    21  UIKit                               0x023a6cde _applyBlockToCFArrayCopiedToStack + 403
    22  UIKit                               0x023a6b0a _afterCACommitHandler + 532
    23  CoreFoundation                      0x03b2653e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    24  CoreFoundation                      0x03b2648f __CFRunLoopDoObservers + 399
    25  CoreFoundation                      0x03b043b4 __CFRunLoopRun + 1076
    26  CoreFoundation                      0x03b03b33 CFRunLoopRunSpecific + 467
    27  CoreFoundation                      0x03b0394b CFRunLoopRunInMode + 123
    28  GraphicsServices                    0x04df39d7 GSEventRunModal + 192
    29  GraphicsServices                    0x04df37fe GSEventRun + 104
    30  UIKit                               0x0238a94b UIApplicationMain + 1225
    31  ShowRoomPrive                       0x0026dfd5 main + 181
    32  ShowRoomPrive                       0x00002ba5 start + 53
)
libc++abi.dylib: terminating with uncaught exception of type NSException

use below code i think you had not added delegate and may this help you.. 使用下面的代码,我认为您尚未添加委托,这可能对您有帮助。

ABPeoplePickerNavigationController *picker =

[[ABPeoplePickerNavigationController alloc] init];

picker.peoplePickerDelegate = self;

[self presentViewController:picker animated:YES completion:nil];

or go through this url its will give you step by tutorial how to use it http://yuvarajmanickam.wordpress.com/2012/09/19/get-contact-number-from-abpeoplepickernavigationcontroller-ios-apps/ or with apple documentation it is show helpfull 或浏览此url,它将逐步指导您如何使用它http://yuvarajmanickam.wordpress.com/2012/09/19/get-contact-number-from-abpeoplepickernavigationcontroller-ios-apps/或与Apple文档一起使用这是有帮助的

https://developer.apple.com/library/ios/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Chapters/QuickStart.html https://developer.apple.com/library/ios/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Chapters/QuickStart.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM