简体   繁体   English

Facebook iOS-无法在“共享”对话框上发布OpenGraph

[英]Facebook iOS - not able to post OpenGraph on Share Dialog

On the following code, when I try to share OG story via Share Dialog, and when I get to the share dialog, the "Post" button isn't enabled (even after I enter text). 在以下代码上,当我尝试通过“共享对话框”共享OG故事时,以及当我进入“共享”对话框时,“发布”按钮均未启用(即使在输入文本后也是如此)。
I had "something went wrong..." in the FB app, but now I don't have it at all 我在FB应用程序中出现“出了点问题...”,但现在我完全没有了

The rest of the post seems OK. 该帖子的其余部分似乎还可以。
Another important thing: Almost a similar variant of this code, but with user generated photo works perfectly, but here the photo is a URL and is not user_generated 另一个重要的事情:这段代码几乎是类似的变体,但是使用用户生成的照片效果很好,但是这里的照片是一个URL,不是用户生成的

The code: 编码:

NSString *FacebookAppNamespace = @"my_fb_namespace";

id<FBGraphObject> object = [FBGraphObject openGraphObjectForPost];
FBOpenGraphActionParams  *params = [[FBOpenGraphActionParams  alloc] init];
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
NSString *previewPropertyName;
        url = [NSString stringWithFormat:@"%@/facebook.html?al_applink_data=type%%3Drecipe%%26id%%3D%@",APPLINKS_LINK,self.recipeID];
        name = self.recipeTitle;
        image = self.recipeImage;
        description = self.recipeTitle;


    object[@"title"] = name;
    object[@"type"] = [NSString stringWithFormat:@"%@:recipe",FacebookAppNamespace];
    object[@"description"] = description;
    object[@"image"] = @[@{@"url": image}]; //NOTE: tried a lot of variants here, thinking this is the cause
    object[@"url"] = url;

    [action setObject:object forKey:@"recipe"];
    params.action = action;
    params.actionType = [NSString stringWithFormat:@"%@:cook",FacebookAppNamespace];

    previewPropertyName = @"recipe";
    if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params]) {
        [FBDialogs presentShareDialogWithOpenGraphAction:action
                                          actionType:params.actionType
                                 previewPropertyName:previewPropertyName
                                             handler:dialogAppErrorHandler];

}

It is confirmed by Facebook that indeed this is a bug in SDK 3.19. Facebook确认这确实是SDK 3.19中的错误。 Actually digging deeper says that this is a bug in Facebook app 15.0 so no need to change SDK 其实更深入地说这是Facebook应用程序15.0中的错误,因此无需更改SDK

I get a similar behavior (it allows me to post, but then i get "oops, something went wrong". 我得到类似的行为(它允许我发布,但是后来我得到“糟糕,出了点问题”。

Somehow, when i tagged a friend in the share dialog, suddenly the entire story appeared (two-to-one), and then the posting/sharing works! 不知何故,当我在“共享”对话框中标记了一个朋友时,突然整个故事出现了(一对二),然后发布/共享成功了!

Try it! 试试吧!

(I still don't know how to make it work without it :( so it's still unacceptable) (我仍然不知道如何在没有它的情况下使它起作用:(因此仍然无法接受)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM