【问题标题】:How to use SLComposeViewController for reply twitter post in iOS?如何在 iOS 中使用 SLComposeViewController 回复推特帖子?
【发布时间】:2014-12-13 02:05:55
【问题描述】:

我目前正在努力将 twitter 集成到我的应用程序中,我尝试对回复 twitter 帖子进行一些研究。我知道如何使用 SLRequest 来做到这一点,但它没有 UI。所以,我想用 SLComposeViewController ui 来回复。大家有什么建议吗?谢谢!

【问题讨论】:

    标签: ios twitter slcomposeviewcontroller


    【解决方案1】:

    在回复特定推文的情况下,请在此处查看此答案:Is there a way of replying to a particular tweet via SLComposerViewController

    因此,除了使用 SLComposeViewController(如下所示)之外,您还需要传递一些附加参数,包括“in_reply_to_status_id”。上面的链接详细解释了这一点。

    您可能希望回复按钮触发如下内容:

    -(IBAction)TweetPressed{
      if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
      {
          SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
          [tweetSheet setInitialText:@"@USERNAME_TO_REPLY_TO"];
          [self presentViewController:tweetSheet animated:YES completion:nil];
    
      }
      else
      {
          UIAlertView *alertView = [[UIAlertView alloc]
                                    initWithTitle:@"Sorry"
                                    message:@"You can't send a tweet right now, make sure your device has an internet connection and you have at least one Twitter account setup"
                                    delegate:self
                                    cancelButtonTitle:@"OK"
                                    otherButtonTitles:nil];
          [alertView show];
      }
    }
    

    这里有完整的教程:http://ios-blog.co.uk/tutorials/integrating-social-media-in-your-apps/

    【讨论】:

    • 我已经尝试过了,但它不起作用,因为它会发布而不是回复帖子
    • 要回复推文,请查看此答案:stackoverflow.com/questions/16815180/…
    • 我已经尝试过了,但是当我尝试获取 view.subview 时是空的。我没有得到按钮视图
    猜你喜欢
    • 2013-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-24
    • 1970-01-01
    • 2013-06-21
    • 2015-08-07
    相关资源
    最近更新 更多