4

This may be a dumb question, but I cannot figure out where to add the fb:explicitly_shared bool.

I'm able to make this work when using the Graph API Explorer, simply by adding the field and setting it to 'true'. Works like a charm.

But when I try to do this from within my iOS app, it simply does NOT work.

- (id<OGObject>)myObjectForObject:(NSDictionary*)object
{

    NSString *format =
    @"http://www.myurl.com/fbobjects/object.php?"
    @"fb:app_id=<my_app_id>&og:type=%@"
    @"&fb:explicitly_shared=true"
    @"&og:title=%@"
    @"&og:description=%@"
    @"&og:image=http://www.myimageurl.com/image.png"
    @"&body=%@";

    id<OGObject> result = (id<OGObject>)[FBGraphObject graphObject];

    // Give it a URL that will echo back the name of the wod as its title,
    // description, and body.
    result.url = [NSString stringWithFormat:format,
                  @"myapp_namespace:object",
                  [object objectForKey:@"title"],
                  [object objectForKey:@"description"],
                  [object objectForKey:@"title"]];

    NSLog(@"%@", result.url);

    return result;
}

This is taken directly from the open graph tutorial for the most part, except for where I've added the fb:explicitly_shared bit.

Where do I need to add this when posting from an iOS device? Any help is much appreciated :)

Warblr
  • 1,188
  • 1
  • 13
  • 27

1 Answers1

11

You need to add the parameter to the action, and what I can tell from your code, it seems that you are trying to add it to the object, which obviously won't work. Here is how I did it:

id<GSOGTrackActivityAction> action = (id<GSOGTrackActivityAction>)[FBGraphObject graphObject];
action.activity = activityObject;

[(NSMutableDictionary *)action setValue:@"true" forKey:@"fb:explicitly_shared"];

(Note that GSOGTrackActivityAction is my custom protocol for typed access to the action object. And "track" is my action and "activity" is my object (in the Open Graph).)

Lukas Petr
  • 1,513
  • 16
  • 19
  • Thanks Lukáš Petr, that was exactly right. Everything is working fine now. I appreciate your response. – Warblr Dec 03 '12 at 00:27