I have a problem about import contacts from contacts list. It is cause of crash app. Here is my code:
GKAddressBook *addressBook = [[GKAddressBook alloc] init];
ABAddressBookRequestAccessWithCompletion(addressBook.addressBookRef, ^(bool granted, CFErrorRef error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (granted) {
UINavigationController *nav = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactsPickerNavigationController"];
PDContactsPicker *picker = nav.viewControllers.firstObject;
picker.addressBook = addressBook;
picker.didSelectContactBlock = ^(GKContact *contact) {
ViewControllerA *viewControllerA = [weakSelf.storyboard instantiateViewControllerWithIdentifier:@"ViewControllerA"];
viewControllerA.contact = contact;
viewControllerA.completeBlock = ^(id result) {
weakSelf.segmentedControl.selectedSegmentIndex = 0;
weakSelf.selectedIcon = 0;
[weakSelf reloadTableView];
[weakSelf presentViewController:[[PortraitNavigationController alloc] initWithRootViewController:editVC] animated:YES completion:nil];
};
[self presentViewController:nav animated:YES completion:nil];
}
});
});
Log not show. It jump to thread like screenshot.
I run on iPhone 6s and iOS 10.1. Someone please help me to solve this problem. You will save a lot of ton time in my life. Thank.