调用图形 api Facebook ios 时出现 facebookErrDomain 错误 10000 [英] facebookErrDomain error 10000 when calling graph api Facebook ios

查看:22
本文介绍了调用图形 api Facebook ios 时出现 facebookErrDomain 错误 10000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在图形 api 上挣扎了几天,我似乎无法再进一步了.

I'm struggling with the graph api for a few days now and I can't seem to get any further.

在我的 appdelegate 中,我将以下代码放在 didFinishLaunching 中

In my appdelegate i've placed the following code within the didFinishLaunching

facebook = [[Facebook alloc] initWithAppId:@"cut-app-id-out"];

    NSArray* permissions =  [[NSArray arrayWithObjects:
                              @"email", @"user_location", @"user_events", @"user_checkins", @"read_stream", nil] retain];

    [facebook authorize:permissions delegate:self];


    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
                                   @"test message from stackoverflow", @"message",                             
                                   nil];

    [facebook requestWithGraphPath:@"/me/feed" andParams:params andDelegate:self];

如您所见,我正在努力让用户满意.我使用以下代码将数据放入适当的字典中.

as you can see i'm trying to get the users feed out. I use the following code to place the data into a proper dictionary.

- (void)request:(FBRequest*)request didLoad:(id)result
{

    if ([result isKindOfClass:[NSDictionary class]]) {
        NSLog(@"count : %d ", [result count]);
        NSArray* resultArray = [result allObjects];

        NSLog(@"count : %d ", [result count]);
        result = [resultArray objectAtIndex:0];

        NSLog(@"count : %d ", [result count]);
        result = [result objectAtIndex:0];

    }
}

但是 didFailWithError: 函数给了我以下错误:操作无法完成.(facebookErrDomain 错误 10000.)

But the didFailWithError: function gives me the following error: The operation couldn’t be completed. (facebookErrDomain error 10000.)

我已将 FBRequestDelegate 放在我的接口文件中,如下所示:

I've place the FBRequestDelegate in my interface file as following:

@interface TabbedCalculationAppDelegate : NSObject 
            <FBRequestDelegate>{

有什么我遗漏的吗?

推荐答案

处理 Facebook 响应需要做更多的工作,尤其是在授权之后.在 authorize 方法之后,您将无法立即调用 Facebook API.请参阅他们的示例代码它显示了如何响应您需要执行的各种事件,最重要的是 fbDidLoginfbDidNotLogin 事件.只有在您成功登录后才能访问 Graph API.

There's a lot more needed to handle Facebook responses, especially after authorization. You're not going to be able to make calls against the Facebook API immediately after the authorize method. Please see their sample code which shows how to respond to the various events which you will need to do, most importantly the fbDidLogin and fbDidNotLogin ones. Only once you have a successful login should you access the Graph API.

此外,您似乎正在尝试使用 Graph API 发布消息.不幸的是,这不是这样做的方法,像 [facebook requestWithGraphPath:@"me/feed" andDelegate:self]; 这样的调用是只读的.再次查看上面的链接,了解如何使用 publish_stream 权限的示例(他们的代码有一个 publishStream 示例方法).

In addition, it looks like you're trying to post a message with the Graph API. Unfortunately that's not the way to do it and a call like [facebook requestWithGraphPath:@"me/feed" andDelegate:self]; is meant for read-only use. Again, look at the above link for an example of how to use the publish_stream permission (their code has a publishStream example method).

这篇关于调用图形 api Facebook ios 时出现 facebookErrDomain 错误 10000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆