我正在使用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.}