在我的应用程序中,我只想在 Facebook 上共享文本。为此,我正在使用 FacebookSDK。
我的代码如下:
NSDictionary *params = @{
@"name" :[NSString stringWithFormat:@"Jinx Share"],
@"caption" : [NSString stringWithFormat:@""],
@"description" :@"Some text to share",
@"picture" : @"",
@"link" : @"",
};
// if the session is closed, then we open it here, and establish a handler for state changes
[FBSession openActiveSessionWithReadPermissions:nil allowLoginUI:YES completionHandler:^(FBSession *session,FBSessionState state, NSError *error)
{
if (error)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
else if(session.isOpen)
{
// Invoke the dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
//NSLog(@"Error publishing story.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
//NSLog(@"User canceled story publishing.");
} else {
//NSLog(@"Story published.");
}
}}];
}
}];
但是当 facebook 共享对话框打开时,它不会在那里显示任何文本。请看下面的截图
如果我在“图片”参数中给出了任何链接,那么它会显示文本。但我不想显示任何图像。我只想在 Facebook 上分享文字。
我的代码有什么问题?有人可以给我解决方案。
最佳答案
自 4 月份的最新 Facebook SDK 以来,Facebook 不允许您的应用预填充任何要共享的内容。这不符合 Facebook 平台政策,see Facebook Platform Policy, 2.3 .另请参阅此 Sharing through Facebook .
关于ios - 使用 FacebookSDK 在 Facebook 上仅共享文本的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32692785/