I'm using SLComposeViewController
to present a very simple share to facebook prompt on the system level. I want the device to handle login via the settings if they are not logged in, so I leave off the check +isAvailableForServiceType
and just go ahead and present the SLComposeViewController.
I noticed that if I try using a service type that isn't on my device (like SLServiceTypeTencentWeibo
) it causes my program to crash. Will this similarly happen in a country where facebook is not on the device, similar to how Tencent Weibo is not on my device?
The crash I get...
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target
I am presenting the SLComposeViewController
like so...
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTencentWeibo];
[controller addURL:[NSURL URLWithString:@"http://www.example.com"]];
[controller addImage:sharedImage];
NSString *postString = [NSString stringWithFormat:@"A cool sharing string!"];
[controller setInitialText:postString];
[self presentViewController:controller animated:YES completion:nil];