简体   繁体   中英

In ios how to get logged in user info using v2 box sdk?

i integrated ios box v2 sdk with my app. I can do all operations other than getting the logged in user info like name, email and so on. Any one solved this issue?. Please let me know.

There is a class called "BoxUser" but i do not know from where and how to call that class and get the info i want.

Thanks

提供了一个用于在sdk中获取当前用户信息的功能:

[[BoxSDK sharedSDK].usersManager userInfoWithID:BoxAPIUserIDMe requestBuilder:nil     success:successBlock failure:failureBlock];
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);
                               }
                           }];
METHOD
GET /users/me

EXAMPLE REQUEST
curl https://api.box.com/2.0/users/me
-H "Authorization: Bearer ACCESS_TOKEN"

More

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM