由于未捕获的异常"NSInvalidArgumentException"而终止应用程序,原因:"-[__NSCFType next]:无法识别的选择器发送到实例"出现此错误是因为此行"[self-autorelease];"如果我评论这一行,那么异常不会出现,但应用程序看起来很慢,所以请告诉我,我能写什么行而不是
if(sqlite3_step(statement)==SQLITE_ROW) { pagestr = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement,0)]; //dateLabel.text=previousDate; //textView.text=pagestr; EditorPage* prev= [[EditorPage alloc] initWithNibName:@"EditorPage" bundle:nil]; prev.dateString= previousDate; prev.bodyString= pagestr; NSArray* array= [[NSArray alloc] initWithObjects:prev,@"forward",nil]; [[NSNotificationCenter defaultCenter] postNotificationName:@"next EditorPage" object:array]; [prev autorelease]; }
何时执行[ self autorelease ]
?我认为这很不寻常——可能是不正确的。
此消息表示您正在将消息下一个发送到NSCFType
的对象。
像这样的消息通常是由向已释放的对象发送消息引起的,该对象的内存随后被重新分配给不同类型的对象。
你可以打开僵尸追踪这类问题此外,您可以将代码移动到ARC,以帮助避免保留/发布问题