2011-03-31 53 views
3

我正在为图表api挣扎几天,现在我似乎无法进一步了。facebookErrDomain错误10000当调用图表api时Facebook ios

在我的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>{ 

有我丢失的东西是什么?

回答

1

还有很多需要处理Facebook的反应,特别是在授权后。在authorize方法后,您无法立即拨打Facebook API。请参阅their sample code,其中显示了如何应对您将需要执行的各种事件,最重要的是fbDidLoginfbDidNotLogin。只有在您成功登录后才能访问Graph API。

此外,它看起来像你试图用Graph API发布消息。不幸的是,这不是做这件事的方式,像[facebook requestWithGraphPath:@"me/feed" andDelegate:self];这样的电话只能用于只读。再次看看上面的链接,了解如何使用publish_stream权限(其代码有publishStream示例方法)的示例。

+0

再次感谢马特!我需要这个! – IosQuestions 2011-03-31 13:46:49

相关问题