gpt4 book ai didi

iphone - 在我的 iPhone 中集成了 Facebook 应用程序,但是当我在我的墙上发帖时,我的 friend 无法分享我该怎么办?

转载 作者:行者123 更新时间:2023-11-28 17:32:46 25 4
gpt4 key购买 nike

我将 facebook 集成到我的一个 iOS 应用程序中,它共享报价。但问题是,当在我的时间线上引用帖子时,我的 friend 无法分享“喜欢”和“评论”。我想分享请看附件截图那么最好的解决方案是我的 FB 应用程序有问题,还是我必须在 iOS 中为此编写代码。

Screenshot of FB

提前致谢

最佳答案

我查看了您的屏幕截图。基本上,这看起来像 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);
}];
}

关于iphone - 在我的 iPhone 中集成了 Facebook 应用程序,但是当我在我的墙上发帖时,我的 friend 无法分享我该怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10749928/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com