Take the 2-minute tour ×

I'm uploading a photo as an open graph object, then tying it into my open graph action once it returns the URL.

Everything is working great so far, but I'm not able to get the custom user message "TEST TEST TEST TEST!" to show up. I've been hitting this issue from all angles and can't seem to get it nailed down. Any ideas?

enter image description here

    - (void)postPhotoThenOpenGraphAction {

        FBRequestConnection *connection = [[FBRequestConnection alloc] init];

        // First request uploads the photo.
        FBRequest *request1 = [FBRequest requestForUploadPhoto:[UIImage imageWithData:[NSData dataWithContentsOfFile:picture.pathSmall]]];

        [connection addRequest:request1 completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

            if (!error) {
            } else {
                [self showFacebookFailedError];

        // Second request retrieves photo information for just-created
        // photo so we can grab its source.
        FBRequest *request2 = [FBRequest requestForGraphPath:@"{result=photopost:$.id}"];

        [connection addRequest:request2 completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

             if (!error && result) {

                 NSString *source = [result objectForKey:@"source"];
                 [self postOpenGraphActionWithPhotoURL:source];

             } else {
                 [self showFacebookFailedError];

        [connection start];


    - (void)postOpenGraphActionWithPhotoURL:(NSString*)photoURL {

        id<PTOGPicture> photoGraphObject = [self pictureObjectForPicture:self.picture];
        id<PTOGSharePicture> action = (id<PTOGSharePicture>)[FBGraphObject graphObject];

        action.photo = photoGraphObject;

        if (self.selectedPlace) {
            action.place = self.selectedPlace;
        if (self.selectedFriends.count > 0) {
            action.tags = self.selectedFriends;

        action.message = @"TEST TEST TEST TEST!";

        if (photoURL) {

            NSMutableDictionary *image = [[NSMutableDictionary alloc] init];

            [image setObject:photoURL forKey:@"url"];

            NSMutableArray *images = [[NSMutableArray alloc] init];
            [images addObject:image];

            action.image = images;

        // Create the request and post the action to the.
        [FBRequestConnection startForPostWithGraphPath:@"me/myappapp:share"
                                     completionHandler:^(FBRequestConnection *connection,
                                                         id result,
                                                         NSError *error) {
           //... code taken out for brevity

share|improve this question
Did you manage to resolve this issue? Custom message is not working for me either. –  vburojevic Jun 30 at 8:37
add comment

1 Answer

I have a simpler version that works for what you want:

First you create your action object as you wish:

- (void)shareOnFacebook {
    NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];
    action[@"<OPEN_GRAPH_OBJ>"] = obj;
    action[@"image[0][url]"] = url;
    action[@"image[0][user_generated]"] = @"true";
    action[@"message"] = @"some message here";

    [FBRequestConnection startForPostWithGraphPath:@"me/<app_namespace>:<action>" graphObject:action completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

However, the requirement for this to work, is that you must have these two permissions set on the action setup page:

enter image description here

I hope it helps.

share|improve this answer
add comment

Your Answer


