iOS11以上的SLServiceTypeTwitter

时间:2018-08-08 07:38:30

标签: twitter slcomposeviewcontroller

我有代码:

#import <Social/Social.h> 
//...
//...
-(void)work {
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
        SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
        [controller setInitialText:@"Its example text for Twitter"];
        [controller addImage:[UIImage imageNamed:@"automobile"]];
        [controller addURL:[NSURL URLWithString:@"http://www.auto.ru"]];

        controller.completionHandler = ^(SLComposeViewControllerResult result) {
            NSLog(@"*** %@", NSStringFromSelector(_cmd));
        };
    } else {
        NSLog(@"The twitter service is not available");
    }
}

但是我有警告: 不推荐使用“ SLServiceTypeTwitter”:在iOS 11.0中首先不推荐使用

并登录:

...[core] isAvailableForServiceType: for com.apple.social.twitter    returning NO
...The twitter service is not available

希望我吗?

0 个答案:

没有答案