Reputation: 1199
In iOS 6, when you create an SLComposeViewController and show it with presentViewController and you have not called isAvailableForServiceType first, you will get the "No Facebook Account" alert view which gives the user an opportunity to set up their account in Settings.
Unfortunately it also shows the native Facebook posting dialog in the background as well.
I would like to have a cleaner experience than popping up two dialogs at the same time, so is there a way to only show the "No Facebook Account" dialog on its own after checking availability with isAvailableForServiceType?
Here's basically what I'd like to do:
// Check to see if the user has a Facebook account set up...
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *vc = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler completionBlock = ^(SLComposeViewControllerResult result){
// do something when complete...
};
[vc setCompletionHandler:completionBlock];
[vc setInitialText:@"Intital text..."];
[self presentViewController:vc animated:YES completion:nil];
} else {
// No Facebook account configured yet,
// so show "No Facebook Account" alert view here.
}
Is this even possible, or will I just need to show a vanilla UIAlertView that tells the user to go to the Settings app and set up their Facebook Account?
BTW, I'm also guarding that block with a call that determines if this device even supports the use of SLComposeViewController, and if not, uses the Facebook SDK instead...
Upvotes: 2
Views: 1002
Reputation: 159
I wish it could be easy!! For now i was able to call the composeViewControllerForServiceType: method even without the account setup so it will show the alert with the settings button, hide the view but i couldn't be able to hide the keyboard!! Maybe you could find a way to reset the UITextFieldDelegate or whatevere esle to not show the keyboard...but I'm not sure! Let me know if you could figure it out!
Upvotes: 1