2016-05-19 20 views
1
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) 
    { 
     imageUser.hidden=NO; 
//   [imageUser sendSubviewToBack:_horizontalScrollView]; 

     SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; 


     UIImage *goImage=[[UIImage alloc]init]; 
     goImage=[self scaleImage:image123]; 

     [controller setInitialText:@"Check out my pic from "]; 
     [controller addURL:[NSURL URLWithString:@"www.awesomeapp.com"]]; 
     [controller addImage:goImage]; 
     imageUser.hidden=YES; 

     [self presentViewController:controller animated:YES completion:Nil]; 
    } 

私は多くのstackoverflow質問を通過し、ほぼすべてを試しました。一部のユーザーがバグとして報告していますが、もし私が私の目標を達成できる他の方法があれば。 Facebookのアプリはありませんが、アプリがあるとき、これは動作しませんとき、それは魔法のように動作します:FacebookアプリがインストールされているときにiOSアプリのコンテンツをFacebookに共有できません

[controller addURL:[NSURL URLWithString:@"www.awesomeapp.com"]]; 

私の目標を達成する助けてください。前もって感謝します。私もして率い

+0

URLの先頭にhttp://を追加しようとしましたか? –

答えて

0

は問題であり、私は私のポッドファイルでFBSDKShareKit

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]) { 
     FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init]; 
     NSString * UrlString = [NSString stringWithFormat:@"https://www.google.co.in/"]; 
           NSString * Subject = [NSString stringWithFormat:@"FBSDKShareKit is an alternative to this issue"]; 
     content.contentURL = [NSURL URLWithString:UrlString]; 
     content.contentTitle = @"FBSDKShareKit"; 
     content.contentDescription = Subject; 
     content.imageURL = [NSURL URLWithString:@"https://i.vimeocdn.com/portrait/58832_300x300.jpg"]; 
     FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init]; 
     dialog.fromViewController = self; 
     dialog.shareContent = content; 
     dialog.mode = FBSDKShareDialogModeFeedBrowser; 
     [dialog show]; 
}else{ 
    //Go with your own method to share in FaceBook 
} 

で管理する方法いくつか:

pod 'FBSDKShareKit', '~> 4.6.0' 

dialog.mode = FBSDKShareDialogModeFeedBrowserそれはあなたの内fbShareDialogを開きますアプリはすべてのデータで構成されています。 FBSDKShareDialogModeShareSheet、FBSDKShareDialogModeBrowser、FBSDKShareDialogModeWeb ...のようなモードのいくつかの他の選択肢を試してみてください。私はFBSDKShareDialogModeFeedBrowserを満たしているとわかりました。試してみましょう、それが動作するかどうかを教えてください。

+0

FBSDK以外の方法がありますか? – Alex

+0

私は他の選択肢にも挑戦しましたが、運がありません。最後はFBSDKで終わりましたが、他のより良い方法があるとは思いません.FBは共有中にコンテンツをあらかじめ入力したくないです。 /developers.facebook.com/policy/#control)上記リンクのポイント3を確認してください。 – Gokul

+0

ゴクル鮮やかにありがとうございます。それは情報の素晴らしい部分です。ハッピーコーディング。 – Alex

関連する問題