I am using the following code (showed on WWDC 2012 videos):
self.accountStore = [[ACAccountStore alloc] init];
ACAccountType *facebookAccountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
[self.accountStore requestAccessToAccountsWithType:facebookAccountType
withCompletionHandler:^(BOOL granted, NSError *e) {
if (granted)
{
NSArray *accounts = [self.accountStore
accountsWithAccountType:facebookAccountType];
self.facebookAccount = [accounts lastObject];
} else {
// Fail gracefully...
}
}];
I have also added the NSDictionary
to my .plist
file:
So, my problem is that I am receiving the following exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Access options are required for this account type.'
I have tried with this ACAccountTypeIdentifierTwitter
and ACAccountTypeIdentifierSinaWeibo
. I am not receiving any exception although they are always returning granted == NO