私は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.}