Rob*_*Bed 11 iphone xcode objective-c ios
当我在模拟器上运行我的应用程序时它运行良好,当我尝试使用设备不起作用,我得到这些错误:
注意:我在我的代码中没有找到任何类的authView
2011-02-24 12:04:14.472 TestP[473:307] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<TestP 0x19d2b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key authView.'
*** Call stack at first throw:
(
0 CoreFoundation 0x33ac0987 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x3347b49d objc_exception_throw + 24
2 CoreFoundation 0x33ac0705 -[NSException dealloc] + 0
3 Foundation 0x3367db4f -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 182
4 Foundation 0x3367d03b _NSSetUsingKeyValueSetter + 90
5 Foundation 0x3367eda3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 194
6 Foundation 0x33630b17 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 130
7 UIKit 0x3224c60f -[UIRuntimeOutletConnection connect] + 66
8 CoreFoundation 0x33a63fc7 -[NSObject(NSObject) performSelector:] + 18
9 CoreFoundation 0x33a6cd51 -[NSArray makeObjectsPerformSelector:] + 388
10 UIKit 0x3224b577 -[UINib instantiateWithOwner:options:] + 586
11 UIKit 0x3224cb39 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
12 UIKit 0x3209e871 -[UIApplication _loadMainNibFile] + 96
13 UIKit 0x3209a1fd -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 180
14 UIKit 0x3206648b -[UIApplication handleEvent:withNewEvent:] + 1114
15 UIKit 0x32065ec9 -[UIApplication sendEvent:] + 44
16 UIKit 0x32065907 _UIApplicationHandleEvent + 5090
17 GraphicsServices 0x33b0ef03 PurpleEventCallback + 666
18 CoreFoundation 0x33a556ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
19 CoreFoundation 0x33a556c3 __CFRunLoopDoSource1 + 166
20 CoreFoundation 0x33a47f7d __CFRunLoopRun + 520
21 CoreFoundation 0x33a47c87 CFRunLoopRunSpecific + 230
22 CoreFoundation 0x33a47b8f CFRunLoopRunInMode + 58
23 UIKit 0x32099309 -[UIApplication _run] + 380
24 UIKit 0x32096e93 UIApplicationMain + 670
25 TestP 0x00002213 main + 98
26 TestP 0x000021ac start + 40
)
terminate called after throwing an instance of 'NSException'
Run Code Online (Sandbox Code Playgroud)
Dav*_*ong 16
你可能已经把你的文件所有者的东西搞砸了你的xibs.在nib unarchiving期间抛出此异常(+[UINib...]
在回溯中证明).它正在尝试连接IBOutlets
您定义的内容.
您的一个视图设置authView
为文件所有者.但是,当取消归档笔尖时,所有者没有authView
属性,因此取消归档失败.
Waq*_*aja 12
@Dave DeLong指出正确.
解决方法
IBOutlet
在xib中附加,但可能在viewController.h文件中遗漏,或者可能是xib文件中缺少某些附加的控件.为什么要在模拟器中运行?有时它会以混乱的方式结束.
只是做一些步骤
现在它运行真正的代码,也可能是设备上的问题解决或者可能是它开始在模拟器上抛出异常,以防万一真的有问题.(我已经提到了解决方法)
这就是我解决这个问题的方法.我进入了我的"故事板"文件并选择了导致问题的视图.然后我单击Connections Inspector
选项卡,您将看到右侧带有感叹号的连接,而不是实心圆圈.删除这些并在必要时进行调整.保存>运行您的应用程序,应该工作.希望这可以帮助 :)
小智 5
我认为引发该异常的一个可能原因是在故事板连接已经完成之后更改了某些IBOutlet变量的名称.因此,故事板中的UI元素仍然引用旧变量名称.我通过检查故事板的XML表示(右键单击.storyboard文件并将其作为源代码打开)并删除旧的(不需要的)IBOutlet变量名称来解决这个问题.
例如,假设您在故事板上有一个UITextField,并具有相应的属性:
@property (retain, nonatomic) IBOutlet UItextField *myTextField;
Run Code Online (Sandbox Code Playgroud)
您将故事板中的UI元素连接到该属性,然后您决定以某种方式重命名该变量.现在,如果您右键单击故事板中的UITextField,您会发现存在两个引用插座 - 旧插座和新插座.您可以通过单击Connections Inspector中的"x"符号或编辑storyboard文件的XML变体来删除旧的.
在 xcode 4 中使用一些引用时出了问题,因为我声明了 IBOutlet 引用 authView 然后运行并且它工作了!,然后我删除了 IBOutlet 声明并运行良好
归档时间: |
|
查看次数: |
41649 次 |
最近记录: |