I am creating a photo app for iOS. I have a custom action-type “take a picture” pair defined in my application. First, I create a photo object (I have a custom image, and I first upload a photo and get an intermediate level URI, after which this code):
NSMutableDictionary *imageData = [NSMutableDictionary dictionaryWithDictionary: @{ @"url" : stagingURL, @"user_generated" : @"true", }]; NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPostWithType:@"tonerapp:photo" title:@"photo" image:imageData url:@"http://tonerapp.info" description:title]; //post the object to facebook [FBRequestConnection startForPostOpenGraphObject:object completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { if(result != nil){ NSString* resultID = [result objectForKey:@"id"]; NSMutableDictionary<FBGraphObject> *actionDict = [FBGraphObject graphObject]; actionDict[@"photo"] = resultID; [self postTakeActionToFacebookWithOpenGraphObject:actionDict completion:action]; }else{ action(NO); } }];
After publishing the object, I will post the “accept” action in the completion handler, as shown above. Here is the code to publish the take action with the photo object:
-(void)postTakeActionToFacebookWithOpenGraphObject:(NSMutableDictionary<FBGraphObject>*)ogObject completion:(booleanAction)action{ if(self.selectedPlace != nil){ ogObject[@"place"] = [self.selectedPlace id]; } if(self.taggedFriends != nil && self.taggedFriends.count > 0){ ogObject[@"tags"] = self.taggedFriends; } [FBRequestConnection startForPostWithGraphPath:@"me/tonerapp:take" graphObject:ogObject completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { if(result != nil){ NSLog(@"oldu"); action(YES); }else{ action(NO); } }]; }
Here is the result:

First, the "post" action is created, then the "accept" action is applied to the photo. I need to get rid of the post action. More strangely, the My Open Chart panel looks like this:

I delete the Object type and the Publish action, but each time they are added to my actions again. I suspect that something that I am doing wrong would cause the default message creation problem, and the default pairs are added to my panel. I go to the settings of my application and change the action of subscribing (creating) my photo type:

Then I will send the photo again. Although my create action takes, the post action is created:

But this time I can’t create any action to “accept”. He does not cope with this answer:
body = { error = { code = 1611231; message = "A post action for this object already exists."; type = Exception; }; }; code = 500;
Shouldn't it be the other way around? Shouldn't I mess this up if I haven't set a default action for my custom action? I also tried to create the photo object “on the fly” (without “sending” it first and sending the JSON object data directly to the “take” action, which, apparently, is a natural way to execute it), but this is also not the case as in this example: Facebook object code example. . Am I missing something, or is something serious wrong with the Open Graph API?
Thanks,
Can.
UPDATE: I have migration on July 2013