带“ me / albums”的FBSDKGraphRequest给出了空的数据列表

时间:2019-04-02 11:41:21

标签: ios objective-c facebook-graph-api fbsdkloginkit

我正在开发一个自2016年以来一直在使用的应用程序。该应用程序具有一项功能,用户可以访问Facebook并获取他/她在其Facebook帐户上上传的相册照片。

此应用程序自2016年到两天前运行良好,但是在这两天中,它提供了空的json数据,例如,

{
   data =     (
    );
}

我们正在使用FBSDKLoginKit 4.43.0和FBSDKCoreKit 4.43.0最新的Facebook工具包,

谢谢。

代码段为

if ([FBSDKAccessToken currentAccessToken]) {

        [[[FBSDKGraphRequest alloc]
           initWithGraphPath:@"me/albums"
          parameters:@{@"fields": @"id, name"}
          HTTPMethod:@"GET"]
         startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
             if (!error) {

                 [MBProgressHUD hideHUDForView:[self view] animated:YES];
                   NSLog(@"%@",result);

                 albumArray = [[NSMutableArray alloc]initWithArray:[result objectForKey:@"data"]];

                 NSLog(@"Album Array : %@",albumArray);

                 [_tableView reloadData];

             }else{

                 [self dismissViewControllerAnimated:YES completion:nil];


             }
    }];


    }else{


        dispatch_async(dispatch_get_main_queue(), ^{
            FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
            [loginManager setLoginBehavior:FBSDKLoginBehaviorNative];

            [loginManager logInWithReadPermissions:@[@"public_profile", @"email", @"user_friends",@"user_photos"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)

             {
                 [[[FBSDKGraphRequest alloc]
                   initWithGraphPath:@"me/albums"
                   parameters: @{@"fields": @"id, name"}
                   HTTPMethod:@"GET"]
                  startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
                      if (!error) {

                          [MBProgressHUD hideHUDForView:[self view] animated:YES];
                            NSLog(@"%@",result);

                          albumArray = [[NSMutableArray alloc]initWithArray:[result objectForKey:@"data"]];

                          NSLog(@"Album Array : %@",albumArray);

                          [_tableView reloadData];

                      }else{


                          [self dismissViewControllerAnimated:YES completion:nil];

                      }

                  }];

             }];

        });

    }

0 个答案:

没有答案