I encountered a problem when using ABNewPersonViewController on iOS9 with xcode 7.1.
I use the following code to edit an exsiting person (goes directly to edit mode).
- (IBAction)editBtnPressed:(id)sender
{
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, NULL);
NSNumber *cid = [self.contact objectForKey:@"contactId"] ;
ABRecordID recordId = (ABRecordID) [cid intValue] ;
ABRecordRef person = ABAddressBookGetPersonWithRecordID(addressBook, recordId);
ABNewPersonViewController *picker = [[ABNewPersonViewController alloc] init] ;
picker.newPersonViewDelegate = self ;
picker.displayedPerson = person ;
picker.navigationItem.title = @"Edit Contact" ;
self.editContactNVC = [[UINavigationController alloc] initWithRootViewController:picker];
[self presentViewController:self.editContactNVC animated:NO completion:nil];
[picker release] ;
}
-(void)newPersonViewController:(ABNewPersonViewController *)newPersonView didCompleteWithNewPerson:(ABRecordRef)person
{
[self.editContactNVC dismissViewControllerAnimated:NO completion:nil] ;
[self.editContactNVC release] ;
}
When executing it the first time it works OK (a little bit slow compared to iOS 8 but OK).
However on second call, only the navigation title is shown, and after a while the app crash with the following log:
2015-10-25 12:15:42.920 VocaNOM[486:108557] plugin com.apple.MobileAddressBook.ContactViewViewService interrupted
2015-10-25 12:15:42.920 VocaNOM[486:108557] plugin com.apple.MobileAddressBook.ContactViewViewService invalidated
2015-10-25 12:15:43.012 VocaNOM[486:108513] viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
2015-10-25 12:15:43.015 VocaNOM[486:108513] [CNUI ERROR] View Service Error, Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.MobileAddressBook.ContactViewViewService.viewservice" UserInfo={NSDebugDescription=connection to service named com.apple.MobileAddressBook.ContactViewViewService.viewservice}
2015-10-25 12:15:43.019 VocaNOM[486:108513] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x2477d85b 0x35e3edff 0x24696c1d 0x289514d3 0x2895c58d 0x24337f91 0x2431d88d 0x2431ebf3 0x242d2bf5 0x28f13f13 0x874d17 0x874d03 0x8797c9 0x24740535 0x2473ea2f 0x246910d9 0x24690ecd 0x2da06af9 0x2891a2dd 0x10c51d 0x3658c873)
libc++abi.dylib: terminating with uncaught exception of type NSException
);
"post_connect_multi_homed" = 1;
"post_connect_session_lifetime" = "6.459692375";
"post_connect_single_homed" = 0;
"post_connect_subflow_attempt_count" = 2;
"post_connect_subflow_max_subflow_count" = 2;
"subflow_switching_count" = 0;
}
On iOS 8.x everything works OK.
Please assist.
Thanks,
Ronny