Mal*_*loc 0 ios facebook-ios-sdk fb-graph ios6
这是我的代码,用于获取代表用户Graph的整个字典:
if (FBSession.activeSession.isOpen) {
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user,
NSError *error) {
if (!error) {
NSLog(@"%@",user);//Displayed with the gender
NSLog(@"%@",user.name);//Name only displayed
NSLog(@"%@",user.gender);//Build error
}
}];
}
Run Code Online (Sandbox Code Playgroud)
我想知道性别数据有什么问题,为什么它没有在字典中找到,实际上,我得到了一个构建错误:
property 'gender' not found on object of type 'NSDictionary<FBGraphUser> *'
Run Code Online (Sandbox Code Playgroud)
小智 7
Facebook没有发送性别来回应"requestForMe".为了获得性别发送请求,请执行以下操作:
NSDictionary* params = [NSDictionary dictionaryWithObject:@"id,gender,name, whatever you like" forKey:@"fields"];
[[FBRequest requestWithGraphPath:[NSString stringWithFormat:"%d",myUserId] parameters:params HTTPMethod:nil] startWithCompletionHandler:...
Run Code Online (Sandbox Code Playgroud)
我不确定,但我认为你也可以将图形路径设置为@"me"而不是用户的id.
| 归档时间: |
|
| 查看次数: |
3761 次 |
| 最近记录: |