【发布时间】:2011-09-24 17:18:52
【问题描述】:
我使用 iOS SDK 4.3 在 XCode (4.0) 中创建了一个新的基于 View 的 iPhone 应用程序。然后我将 ViewController 的名称从 MyProjectNameViewController 更改为 LoginViewController。我还用LoginViewController 替换了我能找到的MyProjectNameViewController 的每个实例,并仔细检查了界面生成器中的所有链接。
然而,当我尝试运行应用程序时,它崩溃了:
2011-06-29 10:21:36.927 Monitoring[12580:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<LoginViewController 0x4b26bf0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key password.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc05a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f14313 objc_exception_throw + 44
2 CoreFoundation 0x00dc04e1 -[NSException raise] + 17
3 Foundation 0x00792677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x007925e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x0020e30c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00d368cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x0020cd23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x0020eab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x000c4628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x000c2134 -[UIViewController loadView] + 120
11 UIKit 0x000c200e -[UIViewController view] + 56
12 UIKit 0x00035d42 -[UIWindow addRootViewControllerViewIfPossible] + 51
13 MyProjectName 0x000022c7 -[MyProjectNameAppDelegate application:didFinishLaunchingWithOptions:] + 135
14 UIKit 0x00012c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
15 UIKit 0x00014d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
16 UIKit 0x0001f617 -[UIApplication handleEvent:withNewEvent:] + 1533
17 UIKit 0x00017abf -[UIApplication sendEvent:] + 71
18 UIKit 0x0001cf2e _UIApplicationHandleEvent + 7576
19 GraphicsServices 0x00ff9992 PurpleEventCallback + 1550
20 CoreFoundation 0x00da1944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
21 CoreFoundation 0x00d01cf7 __CFRunLoopDoSource1 + 215
22 CoreFoundation 0x00cfef83 __CFRunLoopRun + 979
23 CoreFoundation 0x00cfe840 CFRunLoopRunSpecific + 208
24 CoreFoundation 0x00cfe761 CFRunLoopRunInMode + 97
25 UIKit 0x000147d2 -[UIApplication _run] + 623
26 UIKit 0x00020c93 UIApplicationMain + 1160
27 MyProjectName 0x00002209 main + 121
28 MyProjectName 0x00002185 start + 53
我需要做什么来解决这个问题?
【问题讨论】:
-
我还替换了我能找到的每一个实例...我想你错过了一个。
-
说真的,我一遍又一遍地检查了每个类,并查看了 xibs 的源代码,没有一个旧控制器名称的实例。
-
您是手动完成的还是使用重构工具完成的?
-
我猜知道重构工具的存在会为我节省很多时间。但不,我是手工完成的。
-
在发生这种情况时,清理所有目标是您的朋友,如果没有意义,清理所有目标,构建并运行,然后在需要时与墙搏斗。
标签: iphone xcode cocoa-touch ios4 uiviewcontroller