【发布时间】:2014-10-27 17:29:54
【问题描述】:
我正在使用以下代码进行 twitter 分享。在这里,我正在检查设备中是否安装了 twitter 本机应用程序,然后我正在打开本机应用程序,否则我正在打开 webView 以进行 Twitter 共享。使用以下代码,我可以进行 twitter 共享,但问题是成功共享后,回调没有进入我的应用程序,而是进入 twitter 应用程序。
NSURL *instagramURL = [NSURL URLWithString:@"twitter://post?message=hello%20world"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
[[UIApplication sharedApplication] openURL:instagramURL];
} else {
// <a href="twitter://tweet?text=I share this on Twitter from a website">Share this on Twitter</a>
GenericWebViewController *gwvController=[[GenericWebViewController alloc] init];
[gwvController loadWithUrl:[NSURL URLWithString:@"https://twitter.com/intent/tweet?url=www.google.com&text=I%20am%20eating%20branston%20pickel%20right%20now&original_referer=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F9127808%2Fhow-do-you-include-hashtags-within-twitter-share-link-text"] navBarTitle:@"Twitter"];
UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle: @"" style: UIBarButtonItemStyleBordered target: nil action: nil];
[[self navigationItem] setBackBarButtonItem: newBackButton];
[self.navigationController pushViewController:gwvController animated:YES];
//WI-542:Showing the navigation bar in WebView when user user navigate from deal details.
[self.navigationController setNavigationBarHidden:NO animated:NO];
}
成功分享后如何返回我的应用。
【问题讨论】: