我使用SLComposeViewController与facebook共享文章。这是我用来使用SLComposeViewController分享文章的代码。
SLComposeViewController * facebookViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result)
{
[facebookViewController dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
[[[UIAlertView alloc] initWithTitle:@"Result"
message:@"Story not posted"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil]
show];
[self dismissView];
}
break;
case SLComposeViewControllerResultDone:
{
[[[UIAlertView alloc] initWithTitle:@"Result"
message:@"Story posted successfully"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil]
show];
[self dismissView];
}
break;
}};
[facebookViewController addImage:_shareImage];
[facebookViewController setInitialText:_shareTitle];
[facebookViewController addURL:_shareLink];
[facebookViewController setCompletionHandler:completionHandler];
[self.dashboard presentViewController:facebookViewController animated:YES completion:nil];
我在完成处理程序中得到SLComposeViewControllerResultDone的响应,但文章没有出现在facebook墙上。这是sdk的一个问题???
答案 0 :(得分:-2)
我没有导入社交框架标题。因为它没有在墙上发布文章