0

我正在开发 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.}

4

0 回答 0