iphone MGTwitterEngine - post a tweet with my app signature

烈酒焚心 提交于 2019-11-30 15:23:18

You can find detailed information on how to do this in the Readme: http://svn.cocoasourcecode.com/MGTwitterEngine/README.txt

You mentioned that you already received your token, so the next step would be to call the method

- (void)setClientName:(NSString *)name version:(NSString *)version URL:(NSString *)url token:(NSString *)token;

on your MGTwitterEngine instance.

From Twitters new FAQ for applications

If you would like tweets from your application to recieve a source parameter, please register an application and implement OAuth authentication. We will automatically include your application as the source for any tweets sent from your application.

We originally allowed applications to create a source paramter for non-OAuth use but that has been discontinued. Applications pre-OAuth source parameters will remain active, but new registrations are no longer accepted.

So it looks as if you're gonna have to be doing some work!

I was able to get it to work using this demo by Ben Gottlieb:

http://github.com/bengottlieb/Twitter-OAuth-iPhone

Do a search for REPLACE ME and you will able to find where you need to input your consumer key & secret.

The user has to grant your app permission via the Twitter website so it's a bit ugly when you run it the 1st time but it works. I don't know of any alternatives at present - hopefully Twitter will update the process soon. You only have to do the ugly OAuth authentication once. After that, this line:

[_engine sendUpdate: [NSString stringWithFormat: @"Already Updated. %@", [NSDate date]]];

will post an update to your twitter account that should be appended with "from MyCoolApp".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!