【问题标题】:How to send direct message using MGTwitterEngine如何使用 MGTwitterEngine 发送直接消息
【发布时间】:2012-08-24 23:41:31
【问题描述】:

我想使用 https://api.twitter.com/1/direct_messages/new.format 向我的 Twitter 关注者发送直接消息,但不知道如何执行此操作。有人可以为此提供任何示例代码吗?

我对此进行了很多搜索,但没有得到如何获得这些值:

oauth_nonce、oauth_signature、oauth_signature_method、oauth_timestamp、oauth_token。

提前致谢

【问题讨论】:

  • 我终于得到了答案。 -(NSString *)sendDirectMessage:(NSString *)message to:(NSString *)username
  • 你能输入发送私信的代码吗??
  • @Leena 如果您有任何问题,请随时发布查询。
  • 先生查询是关于 MGTwitterEngine。使用这个 SDK 我可以发布推文但不能获取推文。
  • @VinodJat 我也在使用MGTwitterEngine。您能否详细说明code 如何在推特上向关注者发送直接消息?

标签: iphone twitter mgtwitterengine


【解决方案1】:

这是使用 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];
}

【讨论】:

    猜你喜欢
    • 2011-05-08
    • 2022-12-15
    • 2015-01-10
    • 2020-07-14
    • 2012-02-09
    • 1970-01-01
    • 1970-01-01
    • 2016-12-22
    • 1970-01-01
    相关资源
    最近更新 更多