简体   繁体   English

iPhone:如何使用 xAuth 或 OAuth 身份验证在 twitter 上上传照片?

[英]iPhone:How to upload photos on twitter using xAuth or OAuth authentication?

Is there any way to upload photo on Twitter using xAuth or OAuth authentication in iPhone?有没有办法在 iPhone 中使用 xAuth 或 OAuth 身份验证在 Twitter 上上传照片? Is there any sample code or framework I can use?我可以使用任何示例代码或框架吗?

According to this answer it's not possible to upload images directly to Twitter.根据此答案,无法将图像直接上传到 Twitter。 You need to yup load to some other photo-sharing site, and link to it in your Twitter post.您需要加载到其他一些照片共享站点,并在您的 Twitter 帖子中链接到它。 I'd recommend looking into imgur.我建议调查 imgur。 They have an API which you may be able to use.他们有一个 API您可以使用。

It's very easy in iOS 5.在 iOS 5 中非常容易。

Just include the header file #import "Twitter/Twitter.h" and add the framework Twitter.framework in the project..只需包含 header 文件#import "Twitter/Twitter.h"并在项目中添加框架 Twitter.framework..

Then add the lines below for a button action:然后为按钮操作添加以下行:

TWTweetComposeViewController *tweeter =    [[TWTweetComposeViewController alloc] init];
[tweeter setInitialText:@"message"]; // for posting text
[tweeter addImage:image];            // for posting image
[self presentModalViewController:tweeter animated:YES];

Photo sharing uplaod feature is now available on Twitter, but there's no stable library for iphone yet released.照片分享上传功能现已在 Twitter 上可用,但尚未发布适用于 iphone 的稳定库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM