Did you know that you can navigate the posts by swiping left and right?

Issue 0 - ABAddressBookRequestAccessWithCompletion crashes on iOS 10

26 Nov 2016 . category: iOS . Comments
#ios crash

There are a lot of apps was crashed when developers use below code to access contatct in iOS application


- (void)addContact {
    ABAddressBookRef addressBook =  ABAddressBookCreateWithOptions(NULL, NULL);
    ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
        if (granted) {
            _addressBookController = [[ABPeoplePickerNavigationController alloc] init];
            [[_addressBookController navigationBar] setBarStyle:UIBarStyleBlack];
            _addressBookController.delegate = self;
            [_addressBookController setPredicateForEnablingPerson:[NSPredicate predicateWithFormat:@"%K.@count > 0", ABPersonPhoneNumbersProperty]];
            [_addressBookController setPeoplePickerDelegate:self];
            [self presentViewController:_addressBookController animated:YES completion:nil];
        }
        else {
            dispatch_async(dispatch_get_main_queue(), ^{
                [self showMessage:NSLocalizedStringFromTable(@"PLEASE_GRANT_CONTACTS", LIApplicationLanguage(), nil) andAdvertise:@"" andService:nil andTransactionState:kTTTransactionStateInfo];
            });
        }
    });
}

Me

Cuong Nguyen is an awesome person.