1

I've began to program an iOS application, but I ran into a sudden problem. The program worked as intended, I had a single view application, with navigation bar with title Title. When I compiled it, it was okay, but then I decided to "retitle" the title bar to say Hello. And after that I've got an error without a slightest idea what for, cause it worked like a minute before this error and the only change was the title of the title bar.

here is the error

Terminating app due to uncaught exception 'NSUnknownKeyException', reason:               
[<MapViewController 0xa964410> setValue:forUndefinedKey:]: this class is not key
value coding-compliant for the key titleText.'
*** First throw call stack:
(
0   CoreFoundation                      0x027a51e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x025248e5 objc_exception_throw + 44
2   CoreFoundation                      0x02834fe1 -[NSException raise] + 17
3   Foundation                          0x021e4d9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4   Foundation                          0x021511d7 _NSSetUsingKeyValueSetter + 88
5   Foundation                          0x02150731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6   Foundation                          0x021b2b0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7   UIKit                               0x0149b1f4 -[UIRuntimeOutletConnection connect] + 106
8   libobjc.A.dylib                     0x025367de -[NSObject performSelector:] + 62
9   CoreFoundation                      0x027a076a -[NSArray makeObjectsPerformSelector:] + 314
10  UIKit                               0x01499d4d -[UINib instantiateWithOwner:options:] + 1417
11  UIKit                               0x013026f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
12  UIKit                               0x01302e9d -[UIViewController loadView] + 302
13  UIKit                               0x013030d3 -[UIViewController loadViewIfRequired] + 78
14  UIKit                               0x013035d9 -[UIViewController view] + 35
15  UIKit                               0x01223267 -[UIWindow addRootViewControllerViewIfPossible] + 66
16  UIKit                               0x012235ef -[UIWindow _setHidden:forced:] + 312
17  UIKit                               0x0122386b -[UIWindow _orderFrontWithoutMakingKey] + 49
18  UIKit                               0x0122e3c8 -[UIWindow makeKeyAndVisible] + 65
19  Anchor-It                           0x00005a39 -[AppDelegate application:didFinishLaunchingWithOptions:] + 585
20  UIKit                               0x011de14f -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
21  UIKit                               0x011deaa1 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1810
22  UIKit                               0x011e3667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
23  UIKit                               0x011f7f92 -[UIApplication handleEvent:withNewEvent:] + 3517
24  UIKit                               0x011f8555 -[UIApplication sendEvent:] + 85
25  UIKit                               0x011e5250 _UIApplicationHandleEvent + 683
26  GraphicsServices                    0x0381df02 _PurpleEventCallback + 776
27  GraphicsServices                    0x0381da0d PurpleEventCallback + 46
28  CoreFoundation                      0x02720ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
29  CoreFoundation                      0x027209db __CFRunLoopDoSource1 + 523
30  CoreFoundation                      0x0274b68c __CFRunLoopRun + 2156
31  CoreFoundation                      0x0274a9d3 CFRunLoopRunSpecific + 467
32  CoreFoundation                      0x0274a7eb CFRunLoopRunInMode + 123
33  UIKit                               0x011e2d9c -[UIApplication _run] + 840
34  UIKit                               0x011e4f9b UIApplicationMain + 1225
35  Anchor-It                           0x00005dbd main + 141
36  libdyld.dylib                       0x03f5e701 start + 1
37  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Citrus
  • 1,162
  • 1
  • 16
  • 38

1 Answers1

1

Look at this part of the stack trace:

3   Foundation                          0x021e4d9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4   Foundation                          0x021511d7 _NSSetUsingKeyValueSetter + 88
5   Foundation                          0x02150731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6   Foundation                          0x021b2b0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7   UIKit                               0x0149b1f4 -[UIRuntimeOutletConnection connect] + 106

You've got a bad connection in your .xib or storyboard file. The view loading process is trying to connect something to some outlet that doesn't exist, resulting in an exception being thrown. Further information about exactly what connection is bad comes from the exception itself:

[<MapViewController 0xa964410> setValue:forUndefinedKey:]: this class is not key
value coding-compliant for the key titleText.'

So, you've got an instance of MapViewController, and UIRuntimeOutletConnection (part of the view loading system) is trying to set an outlet called titleText. MapViewController apparently doesn't have a titleText property. This could happen because you used to have such a property but deleted it, or because you changed the class of the view controller from something else (that had such a property) to MapViewController (which doesn't), etc.

Caleb
  • 124,013
  • 19
  • 183
  • 272
  • what kind of connection? Can you please specify, because I've looked up my storyboard and everything is kinda connected okay – Citrus Jun 13 '14 at 15:15
  • jesus, it works, you were right, thank you! it was truly the problem that I have unconnected stuff in my code with editor – Citrus Jun 13 '14 at 15:18