我正在使用我正在使用Box SDK的iOS应用程序。在身份验证过程之后,我想获取用户详细信息。我使用以下方法来检索用户详细信息:
[[BoxSDK sharedSDK].usersManager userInfoWithID:BoxAPIUserIDMe requestBuilder:nil success:nil failure:nil];
NSLog(@"BoxAPIUserIDMe : %@",BoxAPIUserIDMe);
我得到了输出:
2014-08-07 18:21:10.867 Boxtry [17246:60b] userid:me
我在输出中收到了“我”。任何人都知道如何检索用户详细信息。
答案 0 :(得分:0)
虽然回答这个问题为时已晚,但我相信这对其他人有帮助。
[[BoxSDK sharedSDK].usersManager userInfoWithID:BoxAPIUserIDMe requestBuilder:nil success:^(BoxUser *user) {
//success block
//get user details as below
self.driveInfo.userName=[user.rawResponseJSON valueForKey:@"name"];
self.driveInfo.emailID=[user.rawResponseJSON valueForKey:@"login"];
float q=[[user.rawResponseJSON valueForKey:@"space_amount"] floatValue];
float totalGB=q/1024/1024/1024;
float q2=[[user.rawResponseJSON valueForKey:@"space_used"] floatValue];
float used=q2/1024/1024;
self.driveInfo.quotaValue=[NSString stringWithFormat:@"%.2f MB of %.2f GB used",used,totalGB];
if (used>1024) {
q2/=1024;
self.driveInfo.quotaValue=[NSString stringWithFormat:@"%.2f GB of %.2f GB used",used,totalGB];
}
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, NSDictionary *JSONDictionary) {
// [[[UIAlertView alloc]initWithTitle:@"Space" message:[NSString stringWithFormat:@"Sorry, unable to get account info"] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil]show];
}];
}