使用objective c在ios 9中共享facebook

使用objective c在ios 9中共享facebook,ios,objective-c,Ios,Objective C,我的应用程序中有facebook共享概念。我需要分享的图像网址,描述和当用户在FB点击图像,这将转到网站。我使用了很多方法,比如SLComposeViewController、FBSDKShareLinkContent、FBShareDialogParams。有时候这些都可以正常工作。有时不起作用。现在,ios 9中不推荐使用FBShareDialogParams。哪些代码在ios9中运行良好。有人知道吗?试试下面的代码:- FBSDKShareLinkContent *sharecontent

我的应用程序中有facebook共享概念。我需要分享的图像网址,描述和当用户在FB点击图像,这将转到网站。我使用了很多方法,比如SLComposeViewController、FBSDKShareLinkContent、FBShareDialogParams。有时候这些都可以正常工作。有时不起作用。现在,ios 9中不推荐使用FBShareDialogParams。哪些代码在ios9中运行良好。有人知道吗?

试试下面的代码:-

FBSDKShareLinkContent *sharecontent = [[FBSDKShareLinkContent alloc]init];
sharecontent.contentTitle = @"Hello ... My Dear Friends";
sharecontent.contentDescription =@"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
{
}
-(void)sharr:(id)sharr没有完成results:(NSDictionary*)results
{
NSLog(@“完成”);
}
-(无效)共享者:(id)共享者错误:(N错误*)错误
{
}
-(作废)SharerDicCancel:(id)sharer
{
}

还有,我发现com.apple.share.Facebook.post无效,使用SLComposer ViewController时出现此警告谢谢。这是正确的,而且运行良好。但只需在fb上共享contentURL即可。图像url(图像)和标题未显示post.FBShareDialogParams中的任何位置在ios9中被弃用。而不是这个,我应该用什么来做这个fb共享。