在我的应用程序中,我SLComposeViewController
用来发送推文。我也addURL:
这样调用它的方法:
[tweetSheet addURL:[NSURL URLWithString:@"http://itunes.com/apps/MyAppName"]];
它在 iOS 6 中运行良好,但在 iOS 7 中,它会在屏幕上显示后立即打开 iTunesStore。我如何解决它?
更新:
if ([SLComposeViewController isAvailableForServiceType:network])
{
AppController *appController = (AppController *)[[UIApplication sharedApplication] delegate];
MyNavigationController *navController = appController.navController;
UIViewController *currentController = [[navController viewControllers] lastObject];
SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:network];
[tweetSheet setInitialText:text];
[tweetSheet addImage:[UIImage imageNamed:temp_character]];
[tweetSheet addURL:[NSURL URLWithString:@"http://itunes.com/apps/MyAppName"]];
tweetSheet.completionHandler = ^(SLComposeViewControllerResult result){
[currentController dismissViewControllerAnimated:YES completion:nil];
if (result == SLComposeViewControllerResultDone)
[[NSNotificationCenter defaultCenter] postNotificationName:HC_TWEET_SENT_NOTIFICATION object:nil];
};
[currentController presentViewController:tweetSheet animated:YES completion:nil];
}