我正在爲使用Facebook的iPhone開發應用程序。 我需要獲取我的數據(當前用戶的數據)。在我的iPhone應用程序上從Facebook獲取朋友信息
我確定我做了正確的登錄並獲得了適當的權限。
現在,
我想用數據的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];
}
有人能幫助我嗎?
感謝你們給我很好的解決方案。我的代碼的問題是返回的數據。我已經理解了這個方法的解決方案: - (void)request:(FBRequest *)request didLoad:(id)result {獲取結果的描述 NSLog(@「\ nDESCRIPTION:%@」,[result描述]); } – Byteros 2012-03-21 13:01:42
歡迎您..您可以通過接受答案來說聲謝謝:) – 2012-03-21 13:42:42