SLServiceTypeTwitter in iOS11 ond over
Asked Answered
S

0

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?

Spritsail answered 8/8, 2018 at 7:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.