Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@evadne
Created May 17, 2013 04:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evadne/5596987 to your computer and use it in GitHub Desktop.
Save evadne/5596987 to your computer and use it in GitHub Desktop.
Correctly Handling ACErrorAccountNotFound
ACAccountStore * const accountStore = [ACAccountStore new];
ACAccountType * const accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
[accountStore requestAccessToAccountsWithType:accountType options:@{
ACFacebookAppIdKey: @"-snip-"
} completion:^(BOOL granted, NSError *error) {
if (!granted) {
switch (error.code) {
case ACErrorAccountNotFound: {
dispatch_async(dispatch_get_main_queue(), ^{
SLComposeViewController *composeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[self presentViewController:composeViewController animated:NO completion:^{
[composeViewController dismissViewControllerAnimated:NO completion:nil];
}];
});
break;
}
default: {
NSLog(@"%s %x %@", __PRETTY_FUNCTION__, granted, error);
[[[UIAlertView alloc] initWithTitle:@"D:" message:error.localizedFailureReason delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
break;
}
}
return;
}
}];
@rolife
Copy link

rolife commented Jul 20, 2013

Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment