Frage

I'm using the code from WWDC to access the user's facebook account:

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...
                                 }
                             }];

but it gives me error on the requestAccessToAccountsWithType:withCompletionHandler:.
enter image description here
How can I access the user's facebook account?

War es hilfreich?

Lösung

Facebook support was only added in 10.8.2. Are you using 10.8.2 yet? If so, what specific error code are you getting? We're not mind-readers.


If you read the headers as you're supposed to do, you'll see that -requestAccessToAccountsWithType:withCompletionHandler: does not exist on Mac, and is deprecated on iOS. You should be using -requestAccessToAccountsWithType:options:completion:.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top