0
if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {
    ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) {
        if (granted) {
            // First time access has been granted, add the contact
            [self prepareContactsIDs];
        } else {
            UIAlertView *accessDenied = [[UIAlertView alloc] initWithTitle:@"Need Access to Addressbook" message:@"KeepItClean requires an access to addressbook in order to be usable" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
            [accessDenied show];
        }
    });
}
else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized) {
    // The user has previously given access, add the contact
    if ([self isFirstRun]) {
        [self prepareContactsIDs];
    }
}
else {
    // The user has previously denied access
    // Send an alert telling user to change privacy setting in settings app
    UIAlertView *accessDenied = [[UIAlertView alloc] initWithTitle:@"Need Access to Addressbook" message:@"KeepItClean requires an access to addressbook in order to be usable" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
    [accessDenied show];
}

ここで理解できないことがあります。ユーザーがアクセスを許可するように求められたときに、キャンセルをタップすると、2 番目の UIAlertView である (accessDenied) アラート ビューが表示されません。

また、ディスパッチングとキューに関連して、私が理解していないことがあると感じています。

4

1 に答える 1