objective c - How to Upload an Animated GIF in Twitter for IOS? -


i have gif image , want share in twitter unfortunately it's not working.

when posted image using twitter api on dev.twitter.com site works fine , animates.

however want post image using twitter ios app/api. know how this?

thanks in advance.

- (void)postimage:(uiimage *)image withstatus:(nsstring *)status url:(nsurl*)urldata {     // uiimage *img = [uiimage animatedimagenamed:@"test.gif" duration:3.0];     nsurl *url = [nsurl urlwithstring:@"https://api.twitter.com/1.1/statuses/update_with_media.json"];     nsmutabledictionary *paramater = [[nsmutabledictionary alloc] init];      //set parameter here. see others acceptable parameters find @ twitter api here : http://bit.ly/occe6r     [paramater setobject:status forkey:@"status"];      acaccountstore *accountstore = [[acaccountstore alloc] init];     acaccounttype *accounttype = [accountstore accounttypewithaccounttypeidentifier:acaccounttypeidentifiertwitter];      [accountstore requestaccesstoaccountswithtype:accounttype options:nil completion:^(bool granted, nserror *error) {         if (granted == yes) {              nsarray *accountsarray = [accountstore accountswithaccounttype:accounttype];              if ([accountsarray count] > 0) {                 acaccount *twitteraccount = [accountsarray lastobject];                  slrequest *postrequest = [slrequest requestforservicetype:slservicetypetwitter requestmethod:slrequestmethodpost url:url parameters:paramater];                  nsdata *imagedata = [nsdata datawithcontentsofurl:urldata]; // gif89a file                  [postrequest addmultipartdata:imagedata withname:@"media[]" type:@"image/gif" filename:@"animated.gif"];                  [postrequest setaccount:twitteraccount]; // or  postrequest.account = twitteraccount;                  [postrequest performrequestwithhandler:^(nsdata *responsedata, nshttpurlresponse *urlresponse, nserror *error) {                     nsstring *output = [nsstring stringwithformat:@"http response status: %i", [urlresponse statuscode]];                     nslog(@"output = %@",output);                     dispatch_async(dispatch_get_main_queue(), ^{                      });                  }];             }          }     }]; } 

just call above method this

[self postimage:nil withstatus:@"your text" url:asseturl] 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -