store = [[ACAccountStore alloc] init];
ACAccountType *twitterType = [store accountTypeWithAccountTypeIdentifier: ACAccountTypeIdentifierTwitter];
// Request Access for Twitter Accounts
[store requestAccessToAccountsWithType:twitterType
withCompletionHandler:^(BOOL granted, NSError *error){
if(granted){
// Handle Granted condition
} else{
// We didn’t get access, output why not
NSLog(@”%@”,[error localizedDescription]);
}
}];
above is a sample authorization requested.
You can get error description in the else part and it is a good idea to show the error description to the user in the alert view or other option is to ask user to allow access for the app through settings app.
You cant switch to the settings app programatically.