2014-09-03 31 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

它更復雜一點。)這種方式工作

,但你會獲得留在您的應用程序中的好處。

相關問題