Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook doesn't accept custom Open Graph properties

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];

Then I add my filter:

object[@"tonerapp:filter"] = filterName;

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}; //wrapping into the data object

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

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

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

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

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

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

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.

like image 233
Can Poyrazoğlu Avatar asked Oct 04 '22 16:10

Can Poyrazoğlu


1 Answers

just put them under "data"

object[@"data"][@"youcustomproperty"] = @"smth";
like image 171
Peter Lapisu Avatar answered Oct 16 '22 19:10

Peter Lapisu