Obj-c initWithCoder 似乎使 NavigationController 崩溃
有谁知道为什么当我添加...
-(id) initWithCoder: (NSCoder *) decoder {
OutputDataMutableArray = [[decoder decodeObjectForKey:@"RootViewControllerPostArray"] retain];
return self;
}
到我的 RootViewController 时,它不会使用 didSelectRowAtIndexPath 方法从表格单元格推送新视图。这就是它似乎挂在上面的线...
[[self navigationController] pushViewController:postController animated:YES];
我没有收到任何错误消息,它似乎只是跳过它。除非我把 initWithCoder 拿出来并且它工作正常。
任何见解都会受到重视。
克里斯
does anyone know why when i add...
-(id) initWithCoder: (NSCoder *) decoder {
OutputDataMutableArray = [[decoder decodeObjectForKey:@"RootViewControllerPostArray"] retain];
return self;
}
to my RootViewController it will not push a new view from a table cell using the didSelectRowAtIndexPath method. This is the line it seems to hang on...
[[self navigationController] pushViewController:postController animated:YES];
i get no error messages, it just seems to skip it. Unless i take the initWithCoder out and it works fine.
any insight would be appriciated.
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您没有调用超类的
-initWithCoder:
实现。You’re not calling the superclass’s implementation of
-initWithCoder:
.检查日志并查找引发的异常,导致代码过早终止。或者在
NSException
引发时设置中断。顺便说一句,您需要在
initWithCoder
中调用[super init]
:Check the log and look for exceptions being thrown causing your code to terminate prematurely. Or set a break on
NSException
raise.BTW, you need to be calling
[super init]
ininitWithCoder
: