2014-09-03 82 views
1

我使用以下代码进行twitter共享。在这里,我正在检查是否在设备中安装了twitter本机应用程序,然后我打开本机应用程序,否则我打开webView以供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]; 

    } 

如何成功共享后回到我的应用程序。

回答

0

你不能!一旦你启动了一个外部应用程序,你就不能回到你的应用程序,除非外部应用程序专门以这种方式完成(例如使用“回调”参数),但很少有“大名”(twitter,facebook,..如果你想使用Twitter和仍然您的应用程序不会退出,使用Twitter的工作框架(https://developer.apple.com/library/ios/documentation/Twitter/Reference/TwitterFrameworkReference/_index.html

它更复杂一点。)这种方式工作

,但你会获得留在您的应用程序中的好处。

相关问题