根据文件 http://developers.facebook.com/docs/howtos/user-data-ios-sdk/#step3
我正在使用以下代码来获取朋友生日的许可
appdelegate.m
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_location",
@"user_birthday",
@"user_likes",
nil];
return [FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:allowLoginUI
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
[self sessionStateChanged:session
state:state
error:error];
}];
}
并在视图controller.m中我正在使用视图中的folwoing代码加载
NSString *query =
@"SELECT uid, name, birthday, birthday_date FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25)";
// Set up the query parameter
NSDictionary *queryParam =
[NSDictionary dictionaryWithObjectsAndKeys:query, @"q", nil];
// Make the API request that uses FQL
[FBRequestConnection startWithGraphPath:@"/fql"
parameters:queryParam
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
} else {
NSLog(@"Result: %@", result);
}
}];
但是我无法得到朋友的生日日期..没有请求发送给朋友访问他的生日..
任何想法?
答案 0 :(得分:2)
您需要在权限数组中添加权限 friends_birthday ,如下所示:
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_location",
@"user_birthday",
@"user_likes",
@"friends_birthday",
nil];
它适合你。