【问题标题】:How can you direct a user to add their twitter account to twitter settings using Twitter.framework?如何使用 Twitter.framework 指导用户将他们的 Twitter 帐户添加到 Twitter 设置?
【发布时间】:2011-12-07 11:17:06
【问题描述】:

在 iOS5 上,是否可以提示并引导用户到 Twitter Settings.app 区域,以便他们可以将其 Twitter 帐户添加到手机?如果有,你是怎么做的?

作为一种解决方法,我可以指导他们打开 Settings.app,仅此而已。

【问题讨论】:

标签: iphone objective-c ios twitter ios5


【解决方案1】:

如果他们的设备上没有 twitter 帐户,我只是在预算不足以实现更复杂功能的应用上弹出一个浏览器,这可能对某些人有用:

if([TWTweetComposeViewController canSendTweet]){ 

   ...

}else{
    NSString *tweet = [NSString stringWithFormat:@"http://twitter.com/intent/tweet?source=SourceApp&text=%@", [tweetText substringToIndex:140]]; 
    tweet = [tweet stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *webLink = [NSURL URLWithString:tweet];
    [[UIApplication sharedApplication] openURL:webLink];

}

【讨论】:

    【解决方案2】:

    我在另一个 SO 帖子中找到了解决方案:

    Open Twitter settings in Settings app

    简短的回答是:

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=TWITTER"]];

    【讨论】:

    【解决方案3】:

    Tweetsheet 自行执行此操作,如果 tweetsheet 发现如果设置下的 twitter 中没有帐户,则它会弹出一个 AlertView,该视图将自动引导用户登录 twitter 的本机设置,更多信息请参阅此链接 http://dl.dropbox.com/u/47726728/tweet%20sheet.swf 下载这个文件,用jing打开或者拖到浏览器上

    【讨论】:

    • 为此,您需要阅读 Apple 本身提供的 API 文档或教程,而不是启动设置,您还可以使用 Apple 提供的 Accounts 框架让用户从您的应用程序登录更多帮助转到苹果的教程视频如果喜欢答案请接受答案
    【解决方案4】:

    正如这里的评论中所述,这是自 5.1 以来 iOS 中的默认行为。只需打开其中一个小部件,如果用户尚未在 iOS 中输入帐户,则会提示用户输入。

    【讨论】:

      猜你喜欢
      • 2023-02-15
      • 2011-09-08
      • 1970-01-01
      • 2013-07-23
      • 2014-02-17
      • 2017-10-15
      • 2012-09-02
      • 1970-01-01
      • 2020-03-06
      相关资源
      最近更新 更多