Вопрос

I'm using the latest SDK and trying to post a story to facebook, but for some reason it doesnt work. It's only working when I try to post with this code:

NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];
action[@"funtone"] = @"http://samples.ogp.me/491689410900420";

[FBRequestConnection startForPostWithGraphPath:@"me/pelephoneil:listen_to"
                                   graphObject:action
                             completionHandler:^(FBRequestConnection *connection,
                                                 id result,
                                                 NSError *error) {
                                 // handle the result
                             }];

It's not working when I try to use this code:

id<FBGraphObject> listenObject =
[FBGraphObject openGraphObjectForPostWithType:@"pelephoneil:listen_to"
                                        title:@"FunTune"
                                        image:@"https://example.com/cooking-app/images/Lamb-Vindaloo.png"
                                          url:@"https://example.com/cooking-app/meal/Lamb-Vindaloo.html"
                                  description:@"text for sample to sample"];

id<FBOpenGraphAction> songAction = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[songAction setObject:listenObject forKey:@"FunTone"];

[FBDialogs presentShareDialogWithOpenGraphAction:songAction
                                      actionType:@"pelephoneil:listen_to"
                             previewPropertyName:@"FunTune"
                                         handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
                                             if(error) {
                                                 NSLog(@"Error: %@", error.description);
                                             } else {
                                                 NSLog(@"Success!");
                                             }
                                         }];

Can someone tell me what seems to be the problem?

Это было полезно?

Решение

I expect you've probably figured this out, but it's probably because the type in the openGraphObjectForPostWithType call should be the object (FunTune), not the action (listen_to)

I also note that the previewPropertyName you've used "FunTune" is different then the "FunTone" you saved it with.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top