NSString *str = [NSString stringWithFormat:@"https://api.box.com/2.0/users/me?access_token=%@",str_access_token];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:str]
cachePolicy:NSURLCacheStorageAllowed
timeoutInterval:20];
[NSURLConnection sendAsynchronousRequest:request
queue:[[NSOperationQueue alloc] init]
completionHandler:^(NSURLResponse *response,
NSData *data,
NSError *error) {
if ([data length] >0 && error == nil) {
NSError *myError = nil;
NSMutableDictionary *userdata = [[NSMutableDictionary alloc] initWithDictionary:[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&myError]];
} else if ([data length] == 0 && error == nil) {
NSLog(@"Nothing was downloaded.");
} else if (error != nil) {
NSLog(@"Error = %@", error);
}
}];