Search code examples
ioscocoa-touchsharesharekit

Share Picture on twitter with shareKit. A shorten URL is visible instead of actual attached image in tweet


I am using shareKit to share something on twitter. I successfully send tweet (only) text by using

 SHKItem *item = [SHKItem  text:@"sample tweet"];
[SHKTwitter shareItem:item];

I try to attach UIImage with tweet using

SHKItem *item = [SHKItem image:[UIImage imageNamed:@"testImage.png"] title:@"posting test image"];
[SHKTwitter shareItem:item];

Although it posts successfully on twitter but instead of actual image shown within tweet it attaches a shorten URL. i.e. posting test image http://img.ly/sMx0

Please tell what i am doing wrong. Is there any other way to attach image within tweet. I want to give iOS compatibility 4.0 to 6.1


Solution

  • You can see from the source code that SHKTwitter always uploads images in tweets to img.ly. There is no option to do otherwise; it only uploads images directly to Twitter when setting the user's profile image.

    It's pretty much only Twitter's web interface that doesn't show an image on img.ly inline in the tweet, though. Most third-party clients will show the image inline the same as they do with images uploaded directly to Twitter.

    So, you'll have to choose one of three options:

    • Live with img.ly. Depending on what you're uploading, this may be a better option; Twitter compresses every image uploaded with some harsh JPEG compression, whereas img.ly will leave PNGs as PNGs.
    • Write and submit a patch to Share Kit to use Twitter's own image uploading API (I assume they have one).
    • Switch to Apple's own Social framework. If you need to support iOS 5, you can use Apple's Twitter framework (Social includes Twitter but requires 6). Neither of Apple's frameworks is an option if you need to have this feature on iOS 4.