我正在尝试使用他们的SDK从Facebook请求数据,我一直都没有得到......
我的.h文件......
#import <UIKit/UIKit.h>
#import "Facebook.h"
@interface VPSettingsViewController : UIViewController <FBRequestDelegate, FBDialogDelegate, FBSessionDelegate> {
Facebook *facebook;
NSArray *items;
}
@end
下面是我的.m文件,它基本上调用了一个请求,当我从Facebook收到请求时应该做某事,但*(void)请求:(FBRequest )请求didLoad:(id)result < / em>永远不会被召唤......
- (void)viewDidLoad
{
[super viewDidLoad];
facebook = [[Facebook alloc] initWithAppId:@"333593533397126" andDelegate:self];
[facebook requestWithGraphPath:@"me/friends" andDelegate:self];
// Do any additional setup after loading the view.
}
- (void)request:(FBRequest *)request didLoad:(id)result {
NSLog(@"Inside didLoad");
if ([result isKindOfClass:[NSArray class]]) {
result = [result objectAtIndex:0];
}
// When we ask for user infor this will happen.
if ([result isKindOfClass:[NSDictionary class]]){
//NSDictionary *hash = result;
NSLog(@"Birthday: %@", [result objectForKey:@"birthday"]);
NSLog(@"Name: %@", [result objectForKey:@"name"]);
}
if ([result isKindOfClass:[NSData class]])
{
NSLog(@"Profile Picture");
//[profilePicture release];
//profilePicture = [[UIImage alloc] initWithData: result];
}
NSLog(@"request returns %@",result);
//if ([result objectForKey:@"owner"]) {}
};
这不是我得到任何错误,只是我从来没有进入负载......没有什么是NSLOGing
我也在iPhone上登录Facebook ...
答案 0 :(得分:0)
这是因为您的请求不会成功。 尝试实现以下代理以了解失败背后的原因:
- (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response;
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error;
还要确保您的班级符合协议FBRequestDelegate
。