I have a little question about my Facebook integration in my App. In my Simulator, it's all perfect, but if I am testing the app at my normal IPhone (5) the Facebook post window don't open. I get no error or warnings but nothing happens.
Maybe you have any ideas, thank you!
Have a nice day!
//edit: my code
- (IBAction)postToFacebook:(id)sender {
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"First post from my iPhone app"];
[self presentViewController:controller animated:YES completion:Nil];
}
}
Just remove this check:
[SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]
Here is how your code should look like:
- (IBAction)postToFacebook:(id)sender {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"First post from my iPhone app"];
[self presentViewController:controller animated:YES completion:Nil];
}
Apparently if you are not logged into Facebook (Settings -> Facebook) then it will return false on the iPhone but returns true on Simulator.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.