我有一个名为UIView
的自定义CustomMarkerInfoWindow
类,其中包含.h
,.m
和xib
个文件。
在xib
文件中,我有2个名为storeNameLabel
和storeAddressLabel
的标签,我已将CustomMarkerInfoWindow
连接为2 IBOutlet
。< / p>
出于某种原因,当我尝试创建这样的对象时:
CustomMarkerInfoWindow *infoWindow=[[[NSBundle mainBundle] loadNibNamed:@"CustomMarkerInfoWindow" owner:self options:nil] firstObject];
应用程序崩溃,我收到此崩溃消息:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<AroundersViewController 0x7fed34820400> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key storeAddressLabel.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000108ad7d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010854bdeb objc_exception_throw + 48
2 CoreFoundation 0x0000000108ad79c9 -[NSException raise] + 9
3 Foundation 0x000000010811619b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
4 UIKit 0x0000000109020d0c -[UIViewController setValue:forKey:] + 88
5 UIKit 0x00000001092577fb -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x0000000108a11890 -[NSArray makeObjectsPerformSelector:] + 224
7 UIKit 0x00000001092561de -[UINib instantiateWithOwner:options:] + 1864
8 UIKit 0x0000000109258415 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 223
9 Arounder 0x0000000104c90fbf -[AroundersViewController mapView:markerInfoWindow:] + 159
10 CoreFoundation 0x00000001089c05cc __invoking___ + 140
11 CoreFoundation 0x00000001089c041e -[NSInvocation invoke] + 286
12 CoreFoundation 0x0000000108a4fd26 -[NSInvocation invokeWithTarget:] + 54
13 Arounder 0x0000000104e66227 -[GMSDelegateForward forwardInvocation:] + 102
14 CoreFoundation 0x0000000108a26b17 ___forwarding___ + 487
15 CoreFoundation 0x0000000108a268a8 _CF_forwarding_prep_0 + 120
16 Arounder 0x0000000104de1853 -[GMSMapView infoWindowForMarker:] + 74
17 Arounder 0x0000000104ddd863 -[GMSMapView setSelectedMarker:] + 514
18 Arounder 0x0000000104ddef93 -[GMSMapView didTapMarker:] + 100
19 Arounder 0x0000000104e25296 -[GMSMarker wasTapped] + 57
20 UIKit 0x0000000109385b28 _UIGestureRecognizerSendTargetActions + 153
21 UIKit 0x000000010938219a _UIGestureRecognizerSendActions + 162
22 UIKit 0x0000000109380197 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 843
23 UIKit 0x0000000109388655 ___UIGestureRecognizerUpdate_block_invoke898 + 79
24 UIKit 0x00000001093884f3 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 342
25 UIKit 0x0000000109375e75 _UIGestureRecognizerUpdate + 2634
26 CoreFoundation 0x00000001089fcc37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
27 CoreFoundation 0x00000001089fcba7 __CFRunLoopDoObservers + 391
28 CoreFoundation 0x00000001089f27fb __CFRunLoopRun + 1147
29 CoreFoundation 0x00000001089f20f8 CFRunLoopRunSpecific + 488
30 GraphicsServices 0x000000010b784ad2 GSEventRunModal + 161
31 UIKit 0x0000000108e8df09 UIApplicationMain + 171
32 Arounder 0x0000000104cb2cef main + 111
33 libdyld.dylib 0x000000010a56192d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
重要部分:this class is not key value coding-compliant for the key storeAddressLabel
(如果我将storeAddressLabel
的崩溃移除storeNameLabel
的相同错误。
我已经搜索了几个小时的解决方案(我试图通过几种方式重新连接插座,尝试重新创建课程......)。
注意:我已经检查了this question,但它不适合我。
我真的不知道为什么会这样,有人可以帮帮我吗?
谢谢!