我必须在iPhone(4.2及更高版本)中集成Twitter API。为此,我使用的是SA_OAuthTwitterEngine + MGTwitterEngine类。
我将应用程序注册到www.twitter.com/apps并将Consumer key和Consumer secret传递给控制器,我的代码就是这个。
if(!_engine){
_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
_engine.consumerKey = KCONSKEY;
_engine.consumerSecret = KCONSECKEY;
}
UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];
if (controller){
[self presentModalViewController: controller animated: YES];
}
我也见过this和this示例。在这两个例子中我们都无法twit ..而且,在这两个例子中,我都收到错误:
failed with error: Error Domain=HTTP Code=401 "The operation couldn’t be completed. (HTTP error 401.)”
请问,任何人都建议如何克服这个问题?
答案 0 :(得分:1)
API有变化,我想MGTwitterEngine没有更新,请参考开发者网站获取更多信息。
http://www.readwriteweb.com/archives/twitter_changes_api_fails_to_notify_developers.php
答案 1 :(得分:0)
[_engine sendUpdate: [NSString stringWithFormat: @"Already Updated. \n%@", [NSDate date]]];