Question

I can't tell why the setInitialText function isn't working in my implementation of SLServiceTypeFacebook. The code I used for Facebook and Twitter are nigh identical except where Facebook replaces the word Twitter, and twitter works just fine. Any help appreciated. Thanks

if ([buttonTitle isEqualToString:@"Facebook"]){

        if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
        {

                SLComposeViewController *faceSheet = [[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook] init];
                NSLog(@"%@", messageField.text);//This returns the appropriate string
                [faceSheet setInitialText:messageField.text];
                //The facebook VC appears, but initial text is not set to messageField.text
                [self presentViewController:faceSheet animated:YES completion:nil];
         }
 }
Was it helpful?

Solution

This certainly is a strange issue, and see as I don't see anything else obviously wrong with this, so here's my suggestion. It is possible that somehow something's getting messed up due to the extraneous initializer you have set on the composer. composeViewControllerForServiceType: already alloc/init's an instance of SLComposeViewController, so there is no need to add init. Replace this:

SLComposeViewController *faceSheet = [[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook] init];

With this line:

SLComposeViewController *faceSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];

OTHER TIPS

This is not an issue, Facebook doesn't allow it anymore.Facebook changes its platform privacy policy for share feature. Use below link for reference

https://developers.facebook.com/docs/sharing/ios

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top