在ios中如何使用v2 box sdk登录用户信息?

时间:2013-12-05 07:19:00

标签: ios iphone box-api

我将ios box v2 sdk与我的应用程序集成在一起。除了获取名称,电子邮件等登录用户信息之外,我可以执行所有操作。有谁解决了这个问题?请告诉我。

有一个名为“BoxUser”的课程,但我不知道从哪里以及如何拨打该课程并获得我想要的信息。

由于

3 个答案:

答案 0 :(得分:4)

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

[[BoxSDK sharedSDK].usersManager userInfoWithID:BoxAPIUserIDMe requestBuilder:nil     success:successBlock failure:failureBlock];

答案 1 :(得分:1)

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);
                               }
                           }];

答案 2 :(得分:0)

METHOD
GET /users/me

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

More