2012-08-08 72 views
0

我是新的一個在twitter5整合在iOS5。照片發佈在iOS5的推特

我需要在twitter上發佈照片來自服務。

我已經搜索了許多,並在此練習了示例教程。 我只收到照片網址。我需要張貼照片。

有誰能幫我解決這個問題嗎? 在此先感謝。

+0

只是照片的URL附加到鳴叫 – Felix 2012-08-08 10:03:17

+0

是的,我做了它。但是在Twitter的網址是posting.my要求張貼照片,因爲它是...幫助我這一點。 – Roopa 2012-08-08 13:24:53

+1

所以你需要下載圖片,然後使用'TWTweetComposeViewController'('addImage'方法) – Felix 2012-08-08 16:34:51

回答

0

首先,你需要保存的圖片,然後你可以發佈保存的圖像嘰嘰喳喳

self.shareImg.image = [UIImage imageNamed:@"Your Saved image"]; 

if ([[[UIDevice currentDevice] systemVersion] floatValue] > 5.0) { 
     // Create the view controller 
     TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init]; 

     NSString *str = [NSString stringWithFormat:@"I created this photo http://%@", iTune]; 

     // Optional: set an image, url and initial text 
     [twitter addImage:self.shareImg.image]; 

     [twitter setInitialText:[NSString stringWithFormat:@"I created this photo using USC Project Trojan App:http://uslofphoto.com. Download http://%@", iTune]]; 

     // Show the controller 
     [self presentModalViewController:twitter animated:YES]; 

     // Called when the tweet dialog has been closed 
     twitter.completionHandler = ^(TWTweetComposeViewControllerResult result) 
     { 
      NSString *title = @"Tweet Status"; 
      NSString *msg; 

      if (result == TWTweetComposeViewControllerResultCancelled) 
       msg = @"Tweet compostion was canceled."; 
      else if (result == TWTweetComposeViewControllerResultDone) 
       msg = @"Tweet composition completed."; 

      // Show alert to see how things went... 
      UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil]; 
      [alertView show]; 

      // Dismiss the controller 
      [self dismissModalViewControllerAnimated:YES]; 
     }; 
    } 
+0

感謝您的回覆 – Roopa 2012-08-13 10:35:21