Reputation: 2357
I am using ACAccountStore for login through Facebook from native settings of iPhone for iOS version 6 or greater. For login I asked for the permission like below :
[accountStore requestAccessToAccountsWithType:accountType options:options completion:^(BOOL granted, NSError *error)
For sharing I want to use the same account. And for sharing i used code like below:
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
but, after login , in case the grant was denied before sharing through settings , then how to get the access of that account again ?
If i do the request again then , it prompts the alert for permissions again.
I just want the account access to that Facebook Account.
Can any one answer ? Thanks In advance. (:
Upvotes: 4
Views: 622
Reputation: 1695
ACAccountStore *accountStore = [[ACAccountStore alloc] init] ;
ACAccountType *facebookAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSLog(@"ACCESS %d",facebookAccountType.accessGranted);
if(facebookAccountType.accessGranted)
{
NSLog (@"You are already granted accees").
}
By using above lines of code you can know whether the user already granted access for Facebook or not.
Upvotes: 2
Reputation: 1019
I guess your user does not want to give your app access to the account anymore if access was revoked through the settings.
As a general advice for interacting with services with privacy protection (applies to Location Services and the like too): Ask for them and use them if the user grants permission. Otherwise respect the user's decision and don't ask for permission again.
If your app absolutely needs a service to work properly you may alert the user when she or he tries to use that particular functionality and explain why your app needs that particular permission.
This approach is outlined in several places throughout Apple's documentation.
Upvotes: 0