Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
202 views
in Technique[技术] by (71.8m points)

ios11 - About "SLComposeViewController" in iOS 11 beta

In my project, I always use SLComposeViewController to share contents with third-party apps, but now, when I update my iPhone to iOS 11 beta, this no longer works.

The SLComposeViewControllerCompletionHandler always callback SLComposeViewControllerResultCancelled.

Why is this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I was having problems with regard to the SLComposer in iOS 11. But I just removed the line that checks and apparently the own SDK makes the validacoes to me internally.

Remove this line serves for any SLServiceType:

if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {

So, develop your logic. In my case:

SLComposeViewController *mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];

        [mySLComposerSheet setInitialText:@"#myInitialTextIsHere"];
        [mySLComposerSheet addURL:[NSURL URLWithString:strURL]];

        [mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {

            switch (result) {
                case SLComposeViewControllerResultCancelled:
                    NSLog(@"Post Canceled");
                    break;
                case SLComposeViewControllerResultDone:
                    NSLog(@"Post Sucessful");
                    break;

                default:
                    break;
            }
        }];

        [self presentViewController:mySLComposerSheet animated:YES completion:nil];

I hope I have helped!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...