是否可以绕过推文对话框并直接发布到推特? [英] Is it possible to bypass the tweet dialog and post directly to twitter?

查看:42
本文介绍了是否可以绕过推文对话框并直接发布到推特?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ShareKit 来实现 Twitter 共享.我有一个带有 textview 的视图控制器,我想在绕过推文输入对话框的同时将该文本发送到 ShareKit 中的帖子.

I am using ShareKit to implement Twitter share. I have a view controller with a textview and would like to send that text to the post in ShareKit while bypassing the tweet input dialog.

SHKItem *item = [SHKItem text:[postText text]];
[SHKTwitter shareItem:item];

如果用户没有登录,上面的代码会验证用户的身份,然后获取我的文本并填充 ShareKits 推文对话框.挖掘他们的代码让我感到困惑.有没有人能够成功地将推文文本直接发布到推特上?

The code above authenticates the user if not logged in, then takes my text and populates ShareKits tweet dialog. Digging through their code has confused the heck out of me. Has anyone been able to successfully post the tweet text directly to twitter?

推荐答案

首先创建一个SHKTwitter的实例并授权给用户:

First, create an instance of SHKTwitter and authorize the user:

twitter = [SHKTwitter new];
[twitter authorize];

然后一旦用户获得授权,设置项目并发送.

Then once the user is authorized, set up the item and send.

SHKItem *item = [SHKItem new];
[item setCustomValue:@"i am tweeting" forKey:@"status"];
twitter.item = item;
[twitter send];

"status" 自定义值特定于 SHKTwitter 类.您需要对 SHKItem 执行其他操作,才能与其他共享者一起使用.例如这适用于 SHKFacebook:

The "status" custom value is specific to the SHKTwitter class. You need to do other things to SHKItem for it to work with other sharers. e.g. this works with SHKFacebook:

item.shareType = SHKShareTypeText;
item.text = "hi";

这篇关于是否可以绕过推文对话框并直接发布到推特?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆