Facebook不接受自定义Open Graph属性 [英] Facebook doesn't accept custom Open Graph properties

查看:175
本文介绍了Facebook不接受自定义Open Graph属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Facebook iOS SDK 3.5发布Open Graph操作。我的行动是:
采取 a 照片照片有一个额外的必需的字符串属性名为过滤器

I'm trying to use Facebook iOS SDK 3.5 for publishing an Open Graph action. My action is: take a photo, and photo has an additional required string property named filter.

我正在创建我的图形对象(所有值都是有效和正常的):

I am creating my graph object (all values are valid and working):

NSMutableDictionary<FBOpenGraphObject> *object =
[FBGraphObject openGraphObjectForPostWithType:@"tonerapp:photo"
                                                title:@"photo"
                                                image:imageData
                                                  url:nil
                                          description:title];

然后我添加过滤器:

object [@tonerapp:filter] = filterName;

我尝试发布对象,我可以确认我的过滤器属性在那里(启用FBSetting URL请求的记录行为以显示请求数据):

I try to post the object, and I can confirm that my filter property is there (enabled FBSetting logging behavior for URL requests to show request data):

Body (w/o attachments): 
object: {"description":"","type":"tonerapp:photo",
"tonerapp:filter":"classic","data":{},
"fbsdk:create_object":true,
"image":{"url":"fbstaging:\/\/graph.facebook.com\/staging_resources\/MDExMDE1MjkzNzU1Njc3MDE0MjoxNTM4NzgwNjUy","user_generated":"true"},
"title":"photo"}

我可以看到我的过滤器属性在那里,但响应是这样的:

I can see my filter property there, but the response is this:

error =    {
        code = 100;
        message = "(#100) Object Missing a Required Value: 
Object at URL '' of type 'tonerapp:photo' is invalid because 
a required property 'tonerapp:filter' of type 'string' was not provided.";
        type = OAuthException;
    };

嗯,它在那里。我尝试了所有可能的组合,例如:

Well, it IS there. I tried all possible combinations such as:

object [@data] = @ {@tonerapp:filter:filterName}; / code> // wrap into the data object

object[@"data"] = @{@"tonerapp:filter": filterName}; //wrapping into the data object

object [@data] = @ {@filter:filterName }; //包装数据并删除命名空间

object[@"data"] = @{@"filter": filterName}; //wrapping into data and removing namespace

object [@toner:filter] = filterName; //应用程序名称而不是命名空间名称

object[@"toner:filter"] = filterName; //app name instead of namespace name

object [@filter] = filterName; // no namespace name at all

object[@"filter"] = filterName; //no namespace name at all

[object setObject:filterName forKey:@tonerapp:filter]; // setobject符号

[object setObject:filterName forKey:@"tonerapp:filter"]; //setobject notation

[object setValue:filterName forKey:@tonerapp:filter]; // setvalue符号

[object setValue:filterName forKey:@"tonerapp:filter"]; //setvalue notation

[object setObject:filterName forKey:@filter]; // setobject AND without命名空间...

[object setObject:filterName forKey:@"filter"]; //setobject AND without namespace...

可能更多。我已经尝试过一切,但是API总是失败,同样的错误。我可以验证对象的其余部分是否正确,如果我在Facebook中转到我的应用程序,并将过滤器设置为可选而不是需要,它成功发布。这是一个缺陷/不足的文档与Graph API,或者我是如此盲目,我看不到在这里明显的东西?

and possibly more. I've tried everything, but the API always fails with the same error. I can verify the rest of the object is correct, if I go to my app in Facebook and set filter as optional instead of required, it posts successfully. Is it a bug/insufficient documentation with the Graph API, or am I so blind that I can't see something obvious here?

谢谢
可以。

Thanks, Can.

推荐答案

只需将它们放在数据下

object[@"data"][@"youcustomproperty"] = @"smth";

这篇关于Facebook不接受自定义Open Graph属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆