调用图 api Facebook ios 时 facebookErrDomain 错误 10000

发布于 2024-10-28 15:49:28 字数 1478 浏览 1 评论 0原文

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

在我的 appdelegate 中,我将以下代码放置在 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];

,如您所见,我正在尝试获取用户提要。我使用以下代码将数据放入正确的字典中。

- (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。)

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

@interface TabbedCalculationAppDelegate : NSObject 
            <FBRequestDelegate>{

有什么我遗漏的吗?

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

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];

    }
}

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

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

@interface TabbedCalculationAppDelegate : NSObject 
            <FBRequestDelegate>{

Is there something what i'm missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仅冇旳回忆 2024-11-04 15:49:28

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

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

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.

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文