IOS ABPeoplePickerNavigationController崩溃
我正在开发一个iOS应用程序。我使用了一个PeoplePickernavigationController。如果另一个屏幕也使用presentModalViewController方法打开,而另一个屏幕也使用presentModalViewController方法打开,则应用程序崩溃 下面是示例代码。我怎样才能纠正它IOS ABPeoplePickerNavigationController崩溃,ios,abpeoplepickerview,Ios,Abpeoplepickerview,我正在开发一个iOS应用程序。我使用了一个PeoplePickernavigationController。如果另一个屏幕也使用presentModalViewController方法打开,而另一个屏幕也使用presentModalViewController方法打开,则应用程序崩溃 下面是示例代码。我怎样才能纠正它 -(IBAction)showContacts:(id)sender{ // ContactListScreen *contact = [[[ContactListScre
-(IBAction)showContacts:(id)sender{
// ContactListScreen *contact = [[[ContactListScreen alloc] initWithTarget:self selector:@selector(loadSelectedPerson:)] autorelease];
// [self presentModalViewController:contact animated:YES];
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
// place the delegate of the picker to the controll
picker.peoplePickerDelegate = self;
if ([Helper isIOS7]) { //IOS_7_Fix
picker.topViewController.navigationController.navigationBar.barTintColor = [UIColor blackColor];
picker.topViewController.navigationController.navigationBar.translucent = NO;
}
// showing the picker
[self presentModalViewController:picker animated:YES];
// releasing
[picker release];
}
- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
NSString *firstName = ( NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
NSString *lastName = ( NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
NSString *phone = @"";
[self dismissModalViewControllerAnimated:YES];
return NO;
}
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
// assigning control back to the main controller
[self dismissModalViewControllerAnimated:YES];
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
return NO;
}
什么是撞车?例外?信号?此外,您正在使用一个不推荐使用的API。改用
presentViewController:animated:completion:
。除了使用不推荐的方法(这似乎不是问题的根源)之外,我在这里没有看到任何问题。您必须确定崩溃的根源。试着打开。如果没有发现具体问题,请与我们分享堆栈跟踪以及您可能拥有的任何其他详细信息。我遇到了类似的情况。你找到错误的来源了吗?