2

This is my code block that i use to post image to the twitter.

NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"info" ofType:@"png"];
    UIImage *image = [[UIImage alloc] initWithContentsOfFile:imagePath];
   NSData *imageData = UIImageJPEGRepresentation(image,.05);
    [_twitter postMediaUploadData:imageData fileName:@"splash_02" uploadProgressBlock:^(NSInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {

    } successBlock:^(NSDictionary *imageDictionary, NSString *mediaID, NSString *size) {
        NSLog(@"xfdf=%@",imageDictionary);

    } errorBlock:^(NSError *error) {
          NSLog(@"xfdferror=%@",error);

    }];

I get response success but no image is posted

Oleg Gordiichuk
  • 15,240
  • 7
  • 60
  • 100

1 Answers1

1

As explained in Twitter's documentation, this method does post the image and returns a mediaID, that can then be used in a tweet. Use this method when you want to post several images and use them all in a future tweet.

If you want to post an image along with a tweet, all in a row, see STTwitter's methods for the POST statuses/update_with_media endpoint.

nst
  • 3,862
  • 1
  • 31
  • 40