断言失败 - [UINib initWithNibName:directory:bundle:]

0 textfield uitextfield ios

当我在视图控制器中触摸uitextfield时,我收到以下消息的错误.

味精:

*** Assertion failure in -[UINib initWithNibName:directory:bundle:], /SourceCache/UIKit/UIKit-2380.17/UINib.m:96
2013-08-26 15:58:43.547 Xpointer[1023:907] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: (name != nil) && ([name length] > 0)'
Run Code Online (Sandbox Code Playgroud)

此错误显示并始终崩溃(所有视图控制器).

Hem*_*ang 7

我也有同样的崩溃,很有趣,我忘了传递笔尖的名字.

不好的代码:

MyViewController *vc = [[MyViewController alloc] initWithNibName:@"" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
[vc release]
Run Code Online (Sandbox Code Playgroud)

好代码:

MyViewController *vc = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
[vc release]
Run Code Online (Sandbox Code Playgroud)