ここで解析中にエラーが発生します。JSON パーサーを使用し
て、以下のコードを参照してください。
- (void)loadDataSource {
// Request
NSString *URLPath = [NSString stringWithFormat:@"https://ajax.googleapis.com/ajax/services/feed/find? v=1.0&q=Official%20Google%20Blogs"];
NSURL *URL = [NSURL URLWithString:URLPath];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
NSInteger responseCode = [(NSHTTPURLResponse *)response statusCode];
if (!error && responseCode == 200) {
id res = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
if (res && [res isKindOfClass:[NSDictionary class]]) {
self.items = [res objectForKey:@"gallery"];
[self dataSourceDidLoad];
} else {
[self dataSourceDidError];
}
} else {
[self dataSourceDidError];
}
}];
}
私はブレークポイントを置きました.NSURL接続からスキップされました.上記のコードに間違いがあるかどうかを検討してください.
前もって感謝します