简体   繁体   中英

How can you direct a user to add their twitter account to twitter settings using Twitter.framework?

On iOS5 is it possible to prompt and direct a user to the Twitter Settings.app area so they can add their twitter account to the phone? If so how do you do it?

As a work around I can direct them to open Settings.app but thats about it.

I just pop a browser if they don't have the twitter account on the device on an app where the budget was not large enough to implement more complex functionality, this may be useful to some people:

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];

}

I found the solution in another SO Post:

Open Twitter settings in Settings app

Short answer is:

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

As noted in a comment here, this is now default behavior in iOS since 5.1. Just open one of those widgets and if the user hasn't input an account into iOS the user will be prompted to do so.

如果tweetsheet发现如果tweet中没有帐户,那么它会自动执行此操作,然后它会弹出一个AlertView,它会自动引导用户登录twitter的本机设置以获取更多信息,请参阅此链接http://dl.dropbox .com / u / 47726728 / tweet%20sheet.swf下载此文件并在jing中打开它或在浏览器中拖动它

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM