0

在我的 iphone 应用程序中,我必须通过 twitter 发送直接消息,问题是 twitter 已将身份验证从基本身份验证更改为 oauth,并且 Web 上的教程已过时

所以我使用 SAOauthTwitterEngine 作为身份验证部分,一切正常。但是这些类不使用 api,所以我必须为此使用 MGTwitterEngine。

问题是 MGTE 没有 oauth 但只有 xauth 和基本身份验证,我不能一起使用它有谁知道怎么做?或知道解释它的教程。

多谢。

4

2 回答 2

1

我建议您使用 OAuth,因为 xAuth 要求您向 twitter 发送一封电子邮件,要求他们授予您许可,并且您必须在您的应用程序上写一个 reort(这对测试应用程序不利)您尝试过吗? https://github.com/bengottlieb/Twitter-OAuth-iPhone

于 2010-11-11T10:16:39.773 回答
1

在我的应用程序中,我使用 MGTwitterEngine 向我的 Twitter 关注者发送直接消息让我们看看:

appDelegate._engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate: self];
appDelegate._engine.consumerKey = kOAuthConsumerKey;
appDelegate._engine.consumerSecret = kOAuthConsumerSecret;

一旦你得到认证,这个方法就会被调用

    #pragma mark SA_OAuthTwitterControllerDelegate

    - (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authenticatedWithUsername: (NSString *)username {
     NSLog(@"Authenicated for %@", username);
     [appDelegate._engine sendDirectMessage:@"Test for Twitter direct message" to:username];
}

希望这会帮助你。

于 2012-09-25T09:58:35.090 回答