7

I have the code:

#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");
    }
}

but i have warning: 'SLServiceTypeTwitter' is deprecated: first deprecated in iOS 11.0

and log:

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

Hope me please?

ZaurGiyasov
  • 126
  • 6

0 Answers0