iOS 5具有深度的Twitter集成。如何检查用户是否在内置的Twitter应用程序中拥有一个帐户(意味着他使用了该帐户),然后执行UIApplication openURL:
来触发跟随用户或预先撰写推文的操作?
iOS 5 SDK中开发人员的新功能之一是支持
Twitter API。苹果使开发人员轻松添加Twitter
支持其应用程序,并允许用户轻松控制是否或
没有应用有权访问其Twitter帐户。
根据this site,这是可能的。 Twitter框架的名称如何?
最佳答案
试试这个:
- (void)tweetButtonPressed:(id)sender
{
Class tweetComposer = NSClassFromString(@"TWTweetComposeViewController");
if( tweetComposer != nil ) {
if( [TWTweetComposeViewController canSendTweet] ) {
TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];
[tweetViewController setInitialText:@"This is a test."]; // set your initial text
tweetViewController.completionHandler = ^(TWTweetComposeViewControllerResult result) {
if( result == TWTweetComposeViewControllerResultDone )
{
// user is done with composing
}
else if( result == TWTweetComposeViewControllerResultCancelled )
{
// user has cancelled composing
}
[self dismissViewControllerAnimated:YES completion:nil];
};
[self presentViewController:tweetViewController animated:YES completion:nil];
}
else {
// The user has no account setup
}
}
else {
// no Twitter integration
}
}
关于iphone - 是否可以检查用户在iOS 5的内置Twitter应用程序中是否具有Twitter帐户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8248068/