[[NSCFString objectForKey:]:无法识别的选择器已发送到实例
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[[NSCFString objectForKey:]:无法识别的选择器已发送到实例相关的知识,希望对你有一定的参考价值。
在此代码中:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
//---initialize the array---
listOfJMovies = [[NSMutableArray alloc] init];
listOfJMoviePosters = [[NSMutableArray alloc] init];
tmdbMovies = [[NSArray alloc] init];
posters = [[NSArray alloc] init];
thumbs = [[NSArray alloc] init];
//---set the title---
self.navigationItem.title = @"Movies";
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
//NSLog(responseString);
SBJsonParser *json = [[SBJsonParser new] autorelease];
tmdbMovies = [json objectWithString:responseString error:nil];
for (id movie in tmdbMovies) {
[listOfJMovies addObject:[movie objectForKey:@"name"]];
NSLog(@"Name: %@", [movie objectForKey:@"name"]);
//[listOfJMoviePosters addObject:[obj objectForKey:@"posters"]];
//NSLog(@"%@", [obj objectForKey:@"posters"]);
posters = [movie objectForKey:@"posters"];
for (id image in posters) {
NSLog(@"image: %@", [image objectForKey:@"image"]);
thumbs = [image objectForKey:@"image"];
for (id url in thumbs) {
NSLog(@"Size: %@", [url objectForKey:@"size"]);
//NSLog(@"blah");
//[listOfJMoviePosters addObject:[url objectForKey:@"size"]];
}
}
}
[[self tableView] reloadData];
[responseString release];
[connection release];
[responseData release];
}
此行:NSLog(@“大小:%@”,[url objectForKey:@“大小”]);
正在导致应用程序崩溃并引发以下错误:
2010-12-30 00:33:29.730 FlixIt [33132:207]-[NSCFString objectForKey:]:无法识别的选择器已发送到实例0x4e50f002010-12-30 00:33:29.732 FlixIt [33132:207] *由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[NSCFString objectForKey:]:无法识别的选择器已发送至实例0x4e50f00'
以上是关于[[NSCFString objectForKey:]:无法识别的选择器已发送到实例的主要内容,如果未能解决你的问题,请参考以下文章
iPhone 应用程序崩溃 [__NSCFString objectForKey:] 无法识别的选择器发送到实例
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[NSCFString objectForKey:]:无法识别的选择器已发送到实例
JSONKit 返回不需要的 NSCFString 而不是 NSDictionary
Swift Userdefaults 将 String 转换为 __NSCFString