Iphone pp必须由Facebook审查。否则,尽管正确授予了权限,但Graph API调用将无法检索此属性。
请考虑到,要获得生日(以及用户简历等其他属性),应用程序必须经过Facebook审查。否则,虽然权限被正确地给出,但是图形API调用将不会检索此属性。请您考虑接受我的答案,因为您接受了我对您的另一个帖子的答案吗?谢谢你能考虑接受我的回答,因为你接受我对你的另一个职位的回答吗?非常感谢。Iphone pp必须由Facebook审查。否则,尽管正确授予了权限,但Graph API调用将无法检索此属性。,iphone,ios,xcode,facebook-graph-api,Iphone,Ios,Xcode,Facebook Graph Api,请考虑到,要获得生日(以及用户简历等其他属性),应用程序必须经过Facebook审查。否则,虽然权限被正确地给出,但是图形API调用将不会检索此属性。请您考虑接受我的答案,因为您接受了我对您的另一个帖子的答案吗?谢谢你能考虑接受我的回答,因为你接受我对你的另一个职位的回答吗?非常感谢。 -(void)request:(FBRequest *)request didLoad:(id)result{ NSLog(@"result is : %@", result); } @protocol
-(void)request:(FBRequest *)request didLoad:(id)result{
NSLog(@"result is : %@", result);
}
@protocol BirthDayLoaderDelegate
-(void)didFinishLoadingRequest:(FBRequest *)request withResult:(id)result;
@end
- (void)request:(FBRequest *)request didLoad:(id)result {
// result is a NSDictionary of your friends and their birthdays!
}
- (void)fbDidLogin {
//some best practice boiler plate code for storing important stuff from fb
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
[defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
[defaults synchronize];
//now load all my friend's birthdays
NSMutableDictionary * params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
@"select birthday, name, uid, pic_square from user where uid in (select uid2 from friend where uid1=me()) order by name",
@"query",
nil];
[self.facebook requestWithMethodName: @"fql.query" andParams: params andHttpMethod: @"POST" andDelegate: self];
}
- (void) loginWithFacebook {
self.facebook = [[[Facebook alloc] initWithAppId:@"<your app id here>" andDelegate:self] autorelease];
//IMPORTANT - you need to ask for permission for friend's birthdays
[facebook authorize:[NSArray arrayWithObject:@"friends_birthday"]];
}
/*
/* Graph API: Method to get the user's friends.
*/
- (void)apiGraphFriendsWithBirthdays {
[self showActivityIndicator];
HackbookAppDelegate *delegate = (HackbookAppDelegate *)[[UIApplication sharedApplication] delegate];
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"picture,id,name,link,birthday,gender,last_name,first_name",@"fields",
nil];
[[delegate facebook] requestWithGraphPath:@"me/friends" andParams:params andHttpMethod:@"GET" andDelegate:self];
/*
* Helper method to first get the user's friends and birthdays then
* do something with it.
*/
- (void)getFriendsForSetBirthday {
// Call the friends Birthday API first
currentAPICall = kAPIFriendsForSetBirthday;
[self apiGraphFriendsWithBirthdays];
}
case kAPIFriendsForSetBirthday:
{
NSMutableArray *friends = [[NSMutableArray alloc] initWithCapacity:1];
NSArray *resultData = [result objectForKey:@"data"];
if ([resultData count] > 0) {
for (NSUInteger i=0; i<[resultData count] && i < 25; i++) {
[friends addObject:[resultData objectAtIndex:i]];
NSDictionary *friend = [resultData objectAtIndex:i];
long long fbid = [[friend objectForKey:@"id"]longLongValue];
NSString *name = [friend objectForKey:@"name"];
NSString *birthday = [friend objectForKey:@"birthday"];
NSLog(@"id: %lld - Name: %@ - Birthday: %@", fbid, name,birthday);
}
} else {
[self showMessage:@"You have no friends."];
}
[friends release];
break;
}
- (void)apiPromptExtendedPermissions {
currentAPICall = kDialogPermissionsExtended;
HackbookAppDelegate *delegate = (HackbookAppDelegate *)[[UIApplication sharedApplication] delegate];
NSArray *extendedPermissions = [[NSArray alloc] initWithObjects:@"user_likes",@"friends_birthday", nil];
[[delegate facebook] authorize:extendedPermissions];
[extendedPermissions release];
}
NSDictionary *graphMenu7 = [[NSDictionary alloc] initWithObjectsAndKeys:
@"Get friends birthday", @"title",
@"You can get all friends birthdays.", @"description",
@"Get friends birthday", @"button",
@"getFriendsForSetBirthday", @"method",
nil];