Is there a way to check if the user is signed in in the device settings? If yes, how?
Also, is there a way to direct the user to the device settings directly to the Facebook account tab? If yes, how?
The thing is, I want to detect if the user is already logged in in the device settings. If yes, then I will let the user share. If not, I want to redirect the user to the device settings in the fb tab and let him decide if he wants to log in or not.
if([SLComposeViewController instanceMethodForSelector:@selector(isAvailableForServiceType)] != nil)
{
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
SLComposeViewController *composeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[composeViewController setInitialText:@"Hello"];
[composeViewController setCompletionHandler:^(SLComposeViewControllerResult result) {
switch (result) {
case SLComposeViewControllerResultCancelled:
[UIAlertView showAlertViewWithTitle:APPNAME message:@"Facebook sharing canceled!!"];
break;
case SLComposeViewControllerResultDone:
[UIAlertView showAlertViewWithTitle:APPNAME message:@"Successfully posted on Facebook."];
break;
default:
break;
}
}];
[[self.window rootViewController] presentViewController:composeViewController animated:YES completion:nil];
}