我使用facebook integrate为我的一个iOS应用程序,它分享报价。但问题是,当在我的时间线上引用帖子时,我的朋友不能只分享“喜欢”和“评论”。我想分享,请看附件截图,所以什么是最好的解决方案,是在我的FB应用程序中有问题,还是我必须为此在iOS中的代码。
Screenshot of FB
提前感谢
发布于 2013-02-09 03:19:54
我看了你的截图。这看起来像fb“就像帖子”。因为没有人不能分享这篇文章。我建议你使用最新的ios fb sdk 3.1.1,然后将FB sdk集成到你的ios应用程序中。然后使用以下代码
对于ios 6和更高版本,请使用ios 6本机fb post方法:
if(NSClassFromString(@"SLComposeViewController") != nil) {
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = NO;
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
if (result == SLComposeViewControllerResultCancelled) {
NSLog(@"\nCancelled");
} else
{
NSLog(@"\nDone");
}
[controller dismissViewControllerAnimated:YES completion:Nil];
};
controller.completionHandler =myBlock;
[controller setInitialText:FB_POST_FEED_INITIAL_TEXT_MSG];
[controller addURL:[NSURL URLWithString:BITLY_VIEW_LINK]]; // youtube video link
[self presentViewController:controller animated:YES completion:Nil];
}否则,请使用此FB sdk方法:
[FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:YES
completionHandler:
^(FBSession *session,
FBSessionState state, NSError *error) {
switch (state) {
case FBSessionStateOpen:
//first shows the hud view then initiating the post message feed process
[self postFBMessageOnUserWall];
break;
case FBSessionStateClosed:
//need to handle
break;
case FBSessionStateClosedLoginFailed:
//need to handle
break;
default:
break;
}
}];
-(void)postFBMessageOnUserWall {
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
FB_POST_FEED_INITIAL_TEXT_MSG, @"name", BITLY_VIEW_LINK, @"link", nil];
[FBRequestConnection
startWithGraphPath:@"me/feed"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
//show the alert says that message successfully posted in your wall
[self performSelectorOnMainThread:@selector(showAlertFromMainThread:) withObject:error waitUntilDone:NO];
NSLog(@"\n\nfb post feed error status = %@", error);
}];
}https://stackoverflow.com/questions/10749928
复制相似问题