gpt4 book ai didi

iphone - 在我的 iPhone 应用程序上从 Facebook 获取好友信息

转载 作者:行者123 更新时间:2023-11-28 23:02:38 26 4
gpt4 key购买 nike

我正在为使用 facebook 的 iPhone 开发一个应用程序。我需要获取我的数据(当前用户的数据)。

我确信我进行了正确的登录并获得了适当的权限。

现在,

我想要一个带有数据的 NSArray 并用 NSLog 打印哦这个数据。

我已经为好友列表做了这个,我没有问题:

-(IBAction)friendsInfo:(id)sender{

// get the logged-in user's friends
[facebook requestWithGraphPath:@"me/friends" andDelegate:self];

}

- (void)request:(FBRequest *)request didLoad:(id)result {
//ok so it's a dictionary with one element (key="data"), which is an array of dictionaries, each with "name" and "id" keys
items = [(NSDictionary *)result objectForKey:@"data"];
for (int i=0; i<[items count]; i++) {
NSDictionary *friend = [items objectAtIndex:i];
long long fbid = [[friend objectForKey:@"id"]longLongValue];
NSString *name = [friend objectForKey:@"name"];
NSLog(@"id: %lld - Name: %@", fbid, name);
}
}

但据我所知,同样的方法不起作用:

-(IBAction)myInfo:(id)sender{

// get information about the currently logged in user
[facebook requestWithGraphPath:@"me" andDelegate:self];

}

有人可以帮助我吗?

最佳答案

使用这个函数获取你的faceBook Info(登录用户信息)

- (void)fetchUserDetails {
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"SELECT uid, name, pic FROM user WHERE uid=me()", @"query",nil];

[fb requestWithMethodName:@"fql.query"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];

关于iphone - 在我的 iPhone 应用程序上从 Facebook 获取好友信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9773854/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com