facebook - iOS requestAccessToAccountsWithType is Not Showing Permission Prompt / NSAlert -
it understanding when invoke [acaccountstore requestaccesstoaccountswithtype:options:completion]
, user supposed see uialert asks them if grant permission app.
when run code, there never prompt , granted
variable "false"
-(void)myfunction { if (!_accountstore) _accountstore = [[acaccountstore alloc] init]; acaccounttype *fbacttype = [_accountstore accounttypewithaccounttypeidentifier:acaccounttypeidentifierfacebook]; nsdictionary *options = [[nsdictionary alloc] initwithobjectsandkeys: (nsstring *)acfacebookappidkey, @"##########", (nsstring *)acfacebookpermissionskey, [nsarray arraywithobject:@"email"], nil]; [_accountstore requestaccesstoaccountswithtype:fbacttype options:options completion:^(bool granted, nserror *error) { nslog(@"home.m - getfbdetails - check 2"); if (granted == yes) { nslog(@"success"); nsarray *accounts = [_accountstore accountswithaccounttype:fbacttype]; _facebookaccount = [accounts lastobject]; [self me]; } else { nslog(@"err: %@ ",error); // fail gracefully... } } ]; }
and error: err: error domain=com.apple.accounts code=8 "the operation couldn’t completed. (com.apple.accounts error 8.)"
update: did testing , if run using acaccounttypeidentifiertwitter
, prompt connect twitter accounts, supposing facebook settings ...
you have inverted objects , keys in options dictionary :
nsdictionary *options = [[nsdictionary alloc] initwithobjectsandkeys: @"##########", acfacebookappidkey, [nsarray arraywithobject:@"email"], acfacebookpermissionskey, nil];
Comments
Post a Comment