iosimagetwittershareslcomposeviewcontroller

SLComposeViewController doesn't attach image to twitter if image is larger than 100kb


I try to post image with text to twitter using following code:

SLComposeViewController *tweetController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetController setInitialText:@"Hello this is a tweet. #somehastag #https://appstore.com/someurl"];
[tweetController addImage:[UIImage imageNamed:@"image.png"]];
[self presentViewController:tweetController animated:YES completion:Nil];


But sometimes image is not showing in dialog and not posting to twitter. [UIImage imageNamed:@"image.png"] is always return not nil and tweetController addImage is always return YES. But image not always attach succsesfully.

Digging more into the issue, I found that image it's not attach when image is larger than 100kb

I'm use png images with 1193x1193px on iOS9.

Do you have any solutions?


Solution

  • I solve this issue with using jpeg image instead of png.