我搜索了很多,我没有成功地得到了朋友的生日Facebook的图形API朋友生日
[facebook requestWithGraphPath:@"me" andDelegate:self];
我应该怎么写的,而不是我得到朋友的生日。 感谢
下面我搜索了很多,我没有成功地得到了朋友的生日Facebook的图形API朋友生日
[facebook requestWithGraphPath:@"me" andDelegate:self];
我应该怎么写的,而不是我得到朋友的生日。 感谢
下面我找到了答案&它如下:
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"select uid,name,birthday_date from user where uid in (select uid2 from friend where uid1=me())", @"query",
nil];
[[StaticFacebook getFacebook] requestWithMethodName: @"fql.query"
andParams: params
andHttpMethod: @"POST"
andDelegate: self];
尝试:
[facebook requestWithGraphPath:@"me/friends"
andParams:[ NSDictionary dictionaryWithObjectsAndKeys:@"picture,id,name,link,gender,last_name,first_name",@"fields",nil]
andDelegate:self];
让我知道,在查询/困难的情况下。
有时候, 生日值将会像“空”或仅“月&日期”或“完整日期”。所以你必须手动检查它。
我有一个要求,我只能显示月份&日期。
您可以从以下功能检查:
+(NSString *)getShortDate:(NSString *)pstrDate{
NSArray *arrayDateData = [pstrDate componentsSeparatedByString:@"/"];
NSString *strShortDate = @"";
if([arrayDateData count]>=2){
strShortDate = [NSString stringWithFormat:@"%@/%@", [arrayDateData objectAtIndex:0], [arrayDateData objectAtIndex:1]];
}
return strShortDate;
}
这里, “pstrDate” 日期值是Facebook的生日日期值。
我希望这对你有帮助。
干杯。
获取friends_birthday使用图形API:
[facebook requestWithGraphPath:@"me/friends?fields=id,name,gender,picture,birthday" andDelegate:self];
,并添加这样的权限:
_permissions = [[NSArray arrayWithObjects:
@"read_friendlists",@"publish_stream ,user_checkins",
@"friends_checkins", @"publish_checkins",@"email", nil]
retain];
恭喜!你的回答帮助我了!这有助于帮助我的朋友和他帮助其他人:D:P –