Hi ,I am an iOS developer . I found some problems about “UIActivityViewController” during the development process.
When I use “UIActivityViewController” in iOS10, everything is okay.
But in iOS11, I can’t share any information to twitter. There is no response when I click the logo of Twitter, even in the system album. Btw, I’ve logged into twitter account in app.
Here is my code:
NSString *textToShare = self.model.title;
UIImage* imageShare = [UIImage imageNamed:@"logo"];
NSURL *urlShare = [NSURL URLWithString:self.model.url];
NSArray *activityItems = @[textToShare, imageShare, urlShare];
UIActivityViewController *actVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
actVC.popoverPresentationController.sourceView = self.view;
[self presentViewController:actVC animated:YES completion:nil];
} else {
[self presentViewController:actVC animated:YES completion:nil];
}
actVC.completionWithItemsHandler = ^(UIActivityType _Nullable activityType, BOOL completed, NSArray * _Nullable returnedItems, NSError * _Nullable activityError) {
NSLog(@"%@",returnedItems);
};
SinaWeibo 、WeCat is going well on iOS11
Share to Twitter ,Console error message:
2017-11-23 13:18:28.037740+0800 xxx[1871:807408] [core] SLComposeViewController initWithExtension: <NSExtension: 0x1c4179500>
{id = com.apple.share.Twitter.post} requestedServiceType: com.apple.social.twitter
2017-11-23 13:18:28.040411+0800 xxx[1871:807408] [core] SLComposeViewController dealloc <SLComposeViewController: 0x105e8c590>
This looks like that Twitter is still use “SLComposeViewController” on iOS11.
So, how can I resolve this problem and share information to Twitter in iOS11? Thanks. Looking forward to your reply.