Reputation: 1682
I'm using some fairly standard code to post to Facebook using the Social Framework. Running on my 6+, the code works as expected, and I can either cancel a post, or successfully post to my Facebook wall.
Problem: The completion handler should give a YES/NO result on whether the post is completed. But the handler returns YES (1) regardless of whether the user presses "cancel" or "post." I've tried a few versions of code I've found and I'm always getting a 1 regardless. The first post I've seen discussing this is just 5 days old -- is this a new bug? Is anybody else seeing this?
SLComposeViewController *mySocialComposer;
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
mySocialComposer = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeFacebook];
[mySocialComposer addImage:[UIImage imageNamed:@"TOEICFlash.png"]];
[mySocialComposer setCompletionHandler:^(SLComposeViewControllerResult result){
NSLog(@"Completion handler = %li", (long)result);
if (result == SLComposeViewControllerResultCancelled)
{
NSLog(@"The user cancelled.");
}
else if (result == SLComposeViewControllerResultDone)
{
NSLog(@"The user posted to Facebook");
}
}];
[self presentViewController:mySocialComposer animated:YES completion:nil];
}
Upvotes: 2
Views: 580