문제

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];
         }
 }
도움이 되었습니까?

해결책

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];

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top