2016-08-03 4 views
-1

私はFacebookの共有概念を自分のアプリに持っています。私は画像のURL、説明を共有する必要があり、ユーザがFBで画像をクリックすると、これはウェブサイトにジャンプします。私はSLComposeViewController、FBSDKShareLinkContent、FBShareDialogParamsのような多くのメソッドを使用しました。これらはすべて正常に動作しています。時々働かない。現在、FOShareDialogParamsはios9では非推奨です。ios9ではどのコードが正常に動作していますか。誰か知っていますか?iOS 9でのfacebookの共有は目的のCを使用して

+0

そしてSLComposerViewcontrollerを使用しながらも、私はこの警告、com.apple.share.Facebook.postが無効になって – Ishwarya

答えて

1

このコードを試してみてください -

FBSDKShareLinkContent *sharecontent = [[FBSDKShareLinkContent alloc]init]; 
sharecontent.contentTitle = @"Hello ... My Dear Friends"; 
sharecontent.contentDescription [email protected]"share this images"; 
sharecontent.imageURL = [NSURL URLWithString:@"http://www.picgifs.com/glitter-gifs/c/congratulations/picgifs-congratulations-178787.gif"]; 
sharecontent.contentURL = [NSURL URLWithString:@"https://itunes.apple.com"]; 

FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init]; 
dialog.fromViewController = self; 
dialog.delegate = self; 
dialog.shareContent = sharecontent; 
[dialog show]; 

// PRAGMA: - デリゲートメソッド

- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results 
{ 
    NSLog(@"Finished"); 
} 

- (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error 
{ 
} 

- (void)sharerDidCancel:(id<FBSDKSharing>)sharer 
{ 
} 
+0

ありがとうございます。それは正しいとうまく動作します。 fb上で共有するのはcontentURLだけです。画像のURL(画像)とタイトルは投稿内のどこにも表示されません。 – Ishwarya

+0

FBShareDialogParamsはios9では非推奨です。これの代わりに、私はこのfb共有に何を使うべきですか? – Ishwarya

関連する問題