-3
A
回答
1
1
您必須使用 「推特圖片提供者」 之類TwitPic,TweetPhoto或yfrog。就我所知,他們通常會提供自己的API。
0
2
以下是利用Twitpic。
正如他人所說,您必須先看API以瞭解請求。
您可以使用Oliver Drobnik的教程:使用NSMutableURLRequest
,或者您可以使用asi-http-request這是CFNetwork的封裝爲HTTP請求
NSData *imageData = UIImagePNGRepresentation(imageToPost);
NSURL *twitpicURL = [NSURL URLWithString:@"http://twitpic.com/api/uploadAndPost"];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:twitpicURL] autorelease];
[request setData:imageData forKey:@"media"];
[request setPostValue:@"myUsername" forKey:@"username"];
[request setPostValue:@"myPassword" forKey:@"password"];
[request setPostValue:@"myMessage" forKey:@"message"];
[request setDelegate:self];
[request setDidFinishSelector:@selector(requestDone:)];
[request setDidFailSelector:@selector(requestFailed:)];
[request start];
你應該看看Uploading UIImages to TwitPic這確實是從頭開始第一個.. 第一個這樣,你明白髮生了什麼事。之後
0
第一進口微幀工作ü編寫此代碼
TWTweetComposeViewControllerCompletionHandler completionHandler =^(TWTweetComposeViewControllerResult result)
{
switch (result) {
case TWTweetComposeViewControllerResultCancelled:
NSLog(@"twitter result:cancelled");
break;
case TWTweetComposeViewControllerResultDone:
NSLog(@"twitter result:sent");
}
[self dismissModalViewControllerAnimated:YES];
};
TWTweetComposeViewController *tvc = [[TWTweetComposeViewController alloc] init];
if(tvc)
{
[self addTweetContentContent:tvc];
tvc.completionHandler = completionHandler;
[self presentModalViewController:tvc animated:YES];
}
本地方法是....
-(void)addTweetContentContent:(id)tvc
{
UIImage *image1 = UIGraphicsGetImageFromCurrentImageContext();
NSData *imageData = UIImagePNGRepresentation(image1);
UIImage *picture = [UIImage imageWithData:imageData];
或
UIImage *picture=[UIImage imageNamed:@"a.png"];
[tvc addImage:picture];
NSString *tweetText = @"write your comands";
[tvc setInitialText:tweetText];
}
相關問題
- 1. 使用twitpic在twitter上上傳圖片
- 2. 使用Ruby on Rails在twitter上上傳多張圖片Twitter Gem
- 3. iPhone:如何上傳照片到Twitter
- 4. 將圖片上傳到iPhone的twitter
- 5. jQuery的圖片上傳,如何上傳
- 6. 使用twitter api在android上傳圖片至twitter
- 7. 如何上傳圖片
- 8. CMS如何上傳圖片?
- 9. SonataMediaBundle - 如何上傳圖片?
- 10. 如何上傳圖片Angular2
- 11. TinyMCE - 如何上傳圖片
- 12. 如何在Android上使用multipart/form-data上傳圖片/圖片
- 13. 在android上上傳圖片
- 14. 圖片上傳未上傳
- 15. 圖片上傳
- 16. 上傳圖片
- 17. 上傳圖片
- 18. 圖片上傳
- 19. 上傳圖片
- 20. 上傳圖片
- 21. 圖片上傳?
- 22. 上傳圖片
- 23. 如何在Laravel的CKEditor上傳服務器端圖片上傳圖片
- 24. 如何在Rails中上傳圖片?
- 25. 如何在BackboneJs中上傳圖片
- 26. 如何在Laravel上傳圖片文件?
- 27. 如何在rails中上傳圖片?
- 28. 如何在android中上傳圖片?
- 29. 如何在上傳前預覽動態上傳的圖片?
- 30. 如何在離子2上的cloudinary上上傳圖片?
由於你能解釋一下如何上傳我們的圖片嗎? TwitPic。 或向我發送使用它的代碼。 – Waseem 2010-06-20 18:16:49
沒有比文檔(http://dev.twitpic.com/)本身好多了。如果你沒有使用這些API的經驗,你應該谷歌一點。我從來沒有開發iPhone(或TwitPic API),所以我不能提供任何具體的代碼。一些谷歌搜索,文檔和一些工作是非常需要的。 – 2010-06-20 18:58:54