没有Facebook App,FBWebDialogs presentFeedDialogModallyWithSession不会显示

时间:2014-12-10 11:02:32

标签: ios objective-c facebook facebook-graph-api

在我的应用程序中,我需要使用Feed Dialog来处理用户手机中未安装Facebook App的情况。 尽管我可以使用FBDialogs canPresentShareDialogWithParams方法共享内容,但我无法使Feed对话工作。对话框没有打开,处理程序也没有被调用。

[FBWebDialogs presentFeedDialogModallyWithSession:nil  parameters:params handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                if (error) {
                    NSLog(@"Error publishing story: %@", error.description);
                } else {
                    if (result == FBWebDialogResultDialogNotCompleted) {
                        NSLog(@"User cancelled.");
                    } else {
                        NSDictionary *urlParams = [self parseURLParams:[resultURL query]];

                        if (![urlParams valueForKey:@"post_id"]) {
                            NSLog(@"User cancelled.");

                        } else {
                            NSString *result = [NSString stringWithFormat: @"Posted story, id: %@", [urlParams valueForKey:@"post_id"]];
                            // do stuff
                            NSLog(@"result %@", result);
                        }
                    }
                }
            }];

iOS7和iOS8上的Teste,结果总是一样。

1 个答案:

答案 0 :(得分:0)

对我来说有用的是将图片和链接字段从NSURL类型更改为NSString。在Facebook docs中有一个很好的例子:

   NSMutableDictionary *params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
 @"Facebook SDK for iOS", @"name",
 @"Build great social apps and get more installs.", @"caption",
 @"The Facebook SDK for iOS makes it easier and faster to develop Facebook integrated iOS apps.", @"description",
 @"https://developers.facebook.com/ios", @"link",
 @"https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png", @"picture",
 nil];

我相信这会解决你的问题。