虽然回答这个问题为时已晚,但我相信它可能对其他人有帮助。
[[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];
}];
}