0
votes

I have a very peculiar problem that I have run into and so far it is happening on only one device (which happens to be the project manager's).

I'm using a SLComposeViewController to post to a user's Facebook wall or to a user's Twitter feed. The Twitter version works perfectly as expected and Facebook works perfectly for everyone except this one device.

The problem is that if the user taps "Post" then the completion handler of the SLComposeViewController is never fired and therefore is still capturing all the user's gestures so the UI seems locked up. The view itself actually disappears but the view controller is never dismissed. If the user taps "Cancel" this behaviour does not occur.

To test I tried calling "dismissViewController" after a period of 5 seconds after the Facebook sheet is displayed and this dismisses the view controller perfectly so the problem is definitely that it is never dismissed after post is pressed.

My code:

- (void) presentFacebookSheet {

    self.faceSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];

    __weak typeof(self) weakSelf = self;
    [[AlertManager defaultManager] alertFacebookPostForCallback:^{

        weakSelf.faceSheet.completionHandler = ^(SLComposeViewControllerResult result) {
            switch (result) {
                case SLComposeViewControllerResultCancelled:
                    NSLog(@"CANCELLED!!");
                    break;

                case SLComposeViewControllerResultDone:
                    NSLog(@"DONE!!");
                    break;

                default:
                    break;
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                [weakSelf dismissViewControllerAnimated:YES completion:^{
                    NSLog(@"Face Sheet has been dismissed.");
                }];
            });
        };

        if(!(weakSelf.faceSheet == nil)) {
            [weakSelf presentViewController:weakSelf.faceSheet animated:YES completion:nil];
        }
    }];


}

Keep in mind that this code is actually working for all other user's except this one so I'm thinking there is possible something wrong with his Facebook setup that is blocking the "post" method from firing the completion handler? I have searched far and wide for an answer but have found nothing so far.

Thanks in advance.

1

1 Answers

0
votes

So I managed to figure out the answer to this incredibly frustrating problem. The problem was with a particular version of the Facebook app which causes Apple's SLComposeViewController to not return o the completion handler and get stuck in that particular state.

I eventually stumbled upon this link: https://developers.facebook.com/bugs/962985360399542/?search_id which lead me to my answer.

Updating the Facebook app on the user's device fixed the issue.