如何使用JSONHTTPClient获取用户最喜欢的youtube视频?

时间:2013-09-28 01:45:26

标签: ios youtube-api

我正在使用youtube应用。我想用JSON获取用户喜欢的视频。

我正在使用以下代码

  NSString *strURL=[NSString stringWithFormat:@"http://gdata.youtube.com/feeds/api/users/%@/favorites",auth.userEmail];
     [JSONHTTPClient getJSONFromURLWithString: strURl
                                      completion:^(NSDictionary *json, JSONModelError *err) {

                                      if (err) {
                                          HideProgress();

                                          [[[UIAlertView alloc] initWithTitle:@"Error"
                                                                      message:@"Please try different keywords or try again later"
                                                                     delegate:nil
                                                            cancelButtonTitle:@"Ok"
                                                            otherButtonTitles: nil] show];
                                          return;
                                      }

                                      //initialize the models
                                      videos = [VideoModel arrayOfModelsFromDictionaries:
                                                json[@"feed"][@"entry"]
                                                ];
                                      if (videos) {
                                          //show the videos
                                          [self showVideos];
                                      } else {
                                          HideProgress();

                                          [[[UIAlertView alloc] initWithTitle:@"Error"
                                                                      message:@"Please try different keywords or try again later"
                                                                     delegate:nil
                                                            cancelButtonTitle:@"Ok"
                                                            otherButtonTitles: nil] show];
                                      }
                                  }];

}

但我收到的错误是:Error Domain=JSONModelErrorDomain Code=1 "Bad network response." UserInfo=0x923d8a0 {NSLocalizedDescription=Bad network response.}

0 个答案:

没有答案