I have a custom UIView
class named CustomMarkerInfoWindow
with .h
, .m
and xib
files.
In the xib
file I have 2 labels called storeNameLabel
and storeAddressLabel
that I've connected to CustomMarkerInfoWindow
as 2 IBOutlet
s.
For some reason, when I try to create a object like this:
CustomMarkerInfoWindow *infoWindow=[[[NSBundle mainBundle] loadNibNamed:@"CustomMarkerInfoWindow" owner:self options:nil] firstObject];
the app crashes and I get this crash message:
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
the important part: this class is not key value coding-compliant for the key storeAddressLabel
(and if I remove storeAddressLabel
its crashes with the same error about storeNameLabel
).
I've searched for hours for solution (I've tried to reconnect the outlets in a couple of ways, tried to recreate the class itself...).
Note: I've already checked this question but it's not working for me.
I really have no idea why it is happenning, can someone please help me?
Thank you!