App crashes if I set delegate and datasource of tableview - ios

Hi I added an UITableView in my app (storyboard) with a custom cell.
Now I wanted to add the delegate and datasource programmatically. If add this code in viewDidLoad the app crashes.
tableView.delegate = self
tableView.dataSource = self
Error:
2016-01-30 16:39:29.283 App[4068:880212] Unknown class TableCell in Interface Builder file.
2016-01-30 16:39:29.289 App[4068:880212] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UITableViewCell 0x7fa3a356bb10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key imgTeam1.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000105302e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000107042deb objc_exception_throw + 48
2 CoreFoundation 0x0000000105302aa9 -[NSException raise] + 9
3 Foundation 0x00000001056cb9bb -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
4 UIKit 0x0000000105bd5fd9 -[UIView(CALayerDelegate) setValue:forKey:] + 173
5 UIKit 0x0000000105edcf41 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x00000001052434a0 -[NSArray makeObjectsPerformSelector:] + 224
7 UIKit 0x0000000105edb924 -[UINib instantiateWithOwner:options:] + 1864
8 UIKit 0x0000000105c654f7 -[UITableView _dequeueReusableViewOfType:withIdentifier:] + 428
9 App 0x0000000105112cd9 _TFC6App14ViewController9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 233
10 App 0x00000001051134ff _TToFC6App14ViewController9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 79
11 UIKit 0x0000000105c78e43 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 766
12 UIKit 0x0000000105c78f7b -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
13 UIKit 0x0000000105c4da39 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2996
14 UIKit 0x0000000105c8201c -[UITableView _performWithCachedTraitCollection:] + 92
15 UIKit 0x0000000105c68edc -[UITableView layoutSubviews] + 224
16 UIKit 0x0000000105bd64a3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
17 QuartzCore 0x000000010a08859a -[CALayer layoutSublayers] + 146
18 QuartzCore 0x000000010a07ce70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
19 QuartzCore 0x000000010a07ccee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
20 QuartzCore 0x000000010a071475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
21 QuartzCore 0x000000010a09ec0a _ZN2CA11Transaction6commitEv + 486
22 QuartzCore 0x000000010a09f37c _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
23 CoreFoundation 0x000000010522e367 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
24 CoreFoundation 0x000000010522e2d7 __CFRunLoopDoObservers + 391
25 CoreFoundation 0x000000010522384c CFRunLoopRunSpecific + 524
26 UIKit 0x0000000105b1a7cd -[UIApplication _run] + 402
27 UIKit 0x0000000105b1f610 UIApplicationMain + 171
28 App 0x000000010511567d main + 109
29 libdyld.dylib 0x0000000107b4b92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I hope your know how to fix this.

It is not fault of data source & delegate ,check for outlet
imgTeam1 connected correctlty.
The outlets in the custom cell in StoryBoard must be connected to the Custom
cell class property
One more thing to add ,instead of setting datasource & delegate in
code set in the StoryBoard.

Apparently you deleted #IBOutlet weak var imgTeam1: UIImageView! (or renamed it) but still connected in the interface builder. You need to add the property again or delete it from the view.

you might delete or miss connection to the delegate imgTeam1 from xib

The answers given thus far are correct. This one simply shows how to take corrective action. You need to select your orange controller on your storyboard for the class where the error occurs. Then select the connections inspector. Find the key mentioned in the error line:
2016-01-30 16:39:29.289 App[4068:880212] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UITableViewCell 0x7fa3a356bb10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key imgTeam1.'
Then click the x next to the key mentioned in the error message. This will clear the error.
If you want to be sure you do not have any further error messages regarding the TableView delegate and datastore just verify whether they already have a connection on the connections inspector. If the delegate/datastore already have a connection on the storyboard then you will not need to add the connections in code.
Just FYI, If you use a UITableViewController, then you will get the delegate/datastore and tableView connections all setup automatically with no need to add anything in code. If you are using a UIViewController with a manually added tableView then you will need to setup the connections for the tableView, delegate, and datastore manually. The delegate/datastore can also be set using the storyboard by control dragging from the connections inspector to the orange view controller.

Related

Xcode 8: Terminating with Uncaught exception of type NSException

I'm a newbie and i'm having this error, i looked up everywhere and i can't find the solution. Any help would be really appreciated!
0 CoreFoundation 0x00000001102bb34b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010d61c21e objc_exception_throw + 48
2 CoreFoundation 0x00000001102bb299 -[NSException raise] + 9
3 Foundation 0x000000010d12c2ff -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
4 UIKit 0x000000010dbafc01 -[UIView(CALayerDelegate) setValue:forKey:] + 173
5 UIKit 0x000000010def9be6 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x0000000110260590 -[NSArray makeObjectsPerformSelector:] + 256
7 UIKit 0x000000010def856a -[UINib instantiateWithOwner:options:] + 1867
8 UIKit 0x000000010dc451e8 -[UITableView _dequeueReusableViewOfType:withIdentifier:] + 399
9 UIKit 0x000000010dc456e0 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 71
10 Foodtracker 0x000000010d0274e7 _TFC11Foodtracker23MealTableViewController9tableViewfTCSo11UITableView12cellForRowAtV10Foundation9IndexPath_CSo15UITableViewCell + 199
11 Foodtracker 0x000000010d027a97 _TToFC11Foodtracker23MealTableViewController9tableViewfTCSo11UITableView12cellForRowAtV10Foundation9IndexPath_CSo15UITableViewCell + 87
12 UIKit 0x000000010dc58ba9 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 757
13 UIKit 0x000000010dc58e07 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
14 UIKit 0x000000010dc2c871 -[UITableView _updateVisibleCellsNow:isRecursive:] + 3295
15 UIKit 0x000000010dc62189 -[UITableView _performWithCachedTraitCollection:] + 110
16 UIKit 0x000000010dc489e3 -[UITableView layoutSubviews] + 222
17 UIKit 0x000000010dbb0344 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
18 QuartzCore 0x000000011306acdc -[CALayer layoutSublayers] + 146
19 QuartzCore 0x000000011305e7a0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
20 QuartzCore 0x000000011305e61e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x0000000112fec62c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
22 QuartzCore 0x0000000113019713 _ZN2CA11Transaction6commitEv + 475
23 QuartzCore 0x000000011301a083 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
24 CoreFoundation 0x000000011025fe17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x000000011025fd87 __CFRunLoopDoObservers + 391
26 CoreFoundation 0x00000001102444b6 CFRunLoopRunSpecific + 454
27 UIKit 0x000000010dae5db6 -[UIApplication _run] + 434
28 UIKit 0x000000010daebf34 UIApplicationMain + 159
29 Foodtracker 0x000000010d028c4f main + 111
30 libdyld.dylib 0x00000001111e568d start + 1
31 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Check your storyboard: All the IBAction, IBOutlet connected and with their current names? It's actually happens when problem with iboutlets
If you just updated to Swift 4 and have issues running your app on iOS 11 device or simulator, maybe you have the same issue I had with the UIVisualEffectView, and specifically with adding subviews to it.
Apple's documentation says:
Add subviews to the contentView and not to UIVisualEffectView
directly.
Basically, instead of adding subviews directly to the UIVisualEffectView, add them to its .contentView.
Example:
// create UIVisualEffectView
let blackBlur = UIVisualEffectView(effect: UIBlurEffect(style: .dark))
// adding a subview - this worked on iOS 10 - crashes the app on iOS 11
blackBlur.addSubview(someView)
// this works on both iOS 10 and iOS 11
blackBlur.contentView.addSubview(someView)
I hope this helps someone since it took me a while to figure this one out.
If anyone is running into this problem make sure that you
Go to Main.storyboard
RIGHT click on the yellow box icon (view controller) at the top of the phone outline
DELETE the outlet(s) with yellow flags.
What happens in instances like this is you probably named an action, then renamed it. You need to delete the old name and if that was the only issue will start right up in simulator!
NOTE: most of the time this happens because of wrong connection so double check and make sure all outlet connections are correct.
The raising method is setValue:forKey:, which is called after a table view cell was dequeued.
Apparently in the MealTableViewController.
Check your table view cells XIB, there might be an IBOutlet remaining with a wrong name, or maybe a property set with the wrong name.
If you are using Firebase and have this problem when you upload be careful with the key value. The keys should not include '#' or '%' or etc. I just deleted and worked fine.

UITableView throwing NSUnkownKeyException on creation of cell

I have really been struggling to fix this NSUnkownKeyException I am getting now upon creation of a cell in my UITableView. This is the line of code causing the error:
let cell = tableView.dequeueReusableCellWithIdentifier("eventCell", forIndexPath: indexPath) as! EventTableViewCell
ACTUAL ERROR:
2016-07-08 19:08:58.879 myApp[15078:1230258] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<myApp.EventTableViewCell 0x7fbed3811000> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010c143d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010df1fdeb objc_exception_throw + 48
2 CoreFoundation 0x000000010c1439c9 -[NSException raise] + 9
3 Foundation 0x000000010c51519b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
4 UIKit 0x000000010ca264b6 -[UIView(CALayerDelegate) setValue:forKey:] + 173
5 UIKit 0x000000010cd357fb -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010c07d890 -[NSArray makeObjectsPerformSelector:] + 224
7 UIKit 0x000000010cd341de -[UINib instantiateWithOwner:options:] + 1864
8 UIKit 0x000000010cab595f -[UITableView _dequeueReusableViewOfType:withIdentifier:] + 428
9 UIKit 0x000000010cab5e32 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 71
10 myApp 0x000000010a81735a _TFC15firebaseTestApp16CEViewController9tableViewfTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 330
11 myApp 0x000000010a817ccf _TToFC15firebaseTestApp16CEViewController9tableViewfTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 79
12 UIKit 0x000000010cac94f4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 766
13 UIKit 0x000000010cac962c -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
14 UIKit 0x000000010ca9dd4f -[UITableView _updateVisibleCellsNow:isRecursive:] + 2996
15 UIKit 0x000000010cad2686 -[UITableView _performWithCachedTraitCollection:] + 92
16 UIKit 0x000000010cab9344 -[UITableView layoutSubviews] + 224
17 UIKit 0x000000010ca26980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
18 QuartzCore 0x0000000111a60c00 -[CALayer layoutSublayers] + 146
19 QuartzCore 0x0000000111a5508e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
20 QuartzCore 0x0000000111a54f0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x0000000111a493c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
22 QuartzCore 0x0000000111a77086 _ZN2CA11Transaction6commitEv + 486
23 QuartzCore 0x0000000111a777f8 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
24 CoreFoundation 0x000000010c068c37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x000000010c068ba7 __CFRunLoopDoObservers + 391
26 CoreFoundation 0x000000010c05e7fb __CFRunLoopRun + 1147
27 CoreFoundation 0x000000010c05e0f8 CFRunLoopRunSpecific + 488
28 GraphicsServices 0x000000010f218ad2 GSEventRunModal + 161
29 UIKit 0x000000010c96bf09 UIApplicationMain + 171
30 myApp 0x000000010a834bf2 main + 114
31 libdyld.dylib 0x000000010e9fa92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Things i checked:
TableView is initialized to the proper class
TableView is connected to UITableViewController
I have checked every outlet I could find to make sure there were not any misconnections or empty connections.
Thank you so much for help, all is appreciated!
dequeueReusableCellWithIdentifier is attempting to instantiate an EventTableViewCell from a .xib it sounds like that file contains an invalid binding which is attempting to set a view property (which does not exist) on the EventTableViewCell. Look at your xib in Xcode, you probably have warnings about invalid outlet bindings.
you should select tableview cell in nib/storyboard and check Outlets in utilities panel.If any broken outlet comes to cell Xcode will put bang mark to connection node.For finding xib/storyboard you should search in xcode with EventTableViewCell

How Do I Fix: Terminating app due to uncaught exception 'NSUnknownKeyException'

I've read that other people have had similar uncaught exceptions, however most seem to be caused by a missing outlet connection. I don't believe mine is related to IBOutlets because the VC runs fine in most scenarios and so do my other VCs.
I think it has to do with Core Data. Here's the error, which I believe occurs in my table's cellForRowAtIndexPath:
2016-01-05 15:18:14.947 Do List[1476:81278] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSManagedObject 0x7fbb89e7cc50> valueForUndefinedKey:]: the entity TomTask is not key value coding-compliant for the key "completedDate".'
*** First throw call stack:
(
0 CoreFoundation 0x0000000102b5ee65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104cfddeb objc_exception_throw + 48
2 CoreFoundation 0x0000000102b5eaa9 -[NSException raise] + 9
3 CoreData 0x0000000102757ec1 -[NSManagedObject valueForUndefinedKey:] + 289
4 Do List 0x000000010235b9d6 _TFC7Do_List24AllocationViewController9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 2630
5 Do List 0x000000010235c24f _TToFC7Do_List24AllocationViewController9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 79
6 UIKit 0x0000000103933e43 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 766
7 UIKit 0x0000000103933f7b -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
8 UIKit 0x0000000103908a39 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2996
9 UIKit 0x000000010393d01c -[UITableView _performWithCachedTraitCollection:] + 92
10 UIKit 0x0000000103923edc -[UITableView layoutSubviews] + 224
11 UIKit 0x00000001038914a3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
12 QuartzCore 0x000000010369659a -[CALayer layoutSublayers] + 146
13 QuartzCore 0x000000010368ae70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
14 QuartzCore 0x000000010368acee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
15 QuartzCore 0x000000010367f475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
16 QuartzCore 0x00000001036acc0a _ZN2CA11Transaction6commitEv + 486
17 UIKit 0x00000001037d4f7c _UIApplicationHandleEventQueue + 7329
18 CoreFoundation 0x0000000102a8aa31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
19 CoreFoundation 0x0000000102a8095c __CFRunLoopDoSources0 + 556
20 CoreFoundation 0x0000000102a7fe13 __CFRunLoopRun + 867
21 CoreFoundation 0x0000000102a7f828 CFRunLoopRunSpecific + 488
22 GraphicsServices 0x0000000106bb7ad2 GSEventRunModal + 161
23 UIKit 0x00000001037da610 UIApplicationMain + 171
24 Do List 0x0000000102368fad main + 109
25 libdyld.dylib 0x000000010a52392d start + 1
26 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
A Few Notes
There's a particular set of VCs that, if run in a particular order, cause this error.
The error occurs when I go from A -> B -> C, then try to unwind to A.
If you look at the exception stack above, the error is happening in the cellForRowAtIndexPath of the allocViewController. That VC is B ,so it shouldn't be loading, just being unwound through.
It references "CompletedDate" which is the new thing I added yesterday that kick this whole thing off. CompletedDate was an existing CoreData attribute which I just started showing in view controller C.
If you look at the first line of the error, it looks like you have a class called TomTask which you're trying to use the "completedDate" from, but there isn't a "completedDate" in TomTask.
It appears (from entry #4 in your call stack) you're trying to do this in your tableView:cellForRowAtIndexPath: method of that view controller.

switching view controllers by button click results in terminating with uncaught exception of type NSException

Hi I am making an app and want to use a button to switch from one view controller to another view controller. I used a modal segue and made a UIbutton action calling performSegueWithIdentifier. However, I got
Terminating with uncaught exception of type NSException
error in AppleDelegate file. I have no idea what's going on here. PLease help me! THanks a lot.
Here is what the program explains:
2015-11-20 01:22:21.575 Photo book[17126:547637] Unknown class ViewController1 in Interface Builder file.
2015-11-20 01:22:21.581 Photo book[17126:547637] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7f9698e1d2b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Open.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000103d7fc65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000103a18bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000103d7f8a9 -[NSException raise] + 9
3 Foundation 0x00000001035aeb53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x0000000103cc7d50 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x000000010469252b -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x00000001048f4aba -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
7 UIKit 0x00000001048f80bf -[UIStoryboardSegueTemplate _perform:] + 71
8 UIKit 0x0000000111251638 -[UIViewControllerAccessibility performSegueWithIdentifier:sender:] + 39
9 Photo book 0x0000000103479c66 _TFC10Photo_book14ViewController5LoginfS0_FCSo8UIButtonT_ + 278
10 Photo book 0x0000000103479cea _TToFC10Photo_book14ViewController5LoginfS0_FCSo8UIButtonT_ + 58
11 UIKit 0x00000001043bbda2 -[UIApplication sendAction:to:from:forEvent:] + 75
12 UIKit 0x00000001044cd54a -[UIControl _sendActionsForEvents:withEvent:] + 467
13 UIKit 0x00000001044cc919 -[UIControl touchesEnded:withEvent:] + 522
14 UIKit 0x0000000104408998 -[UIWindow _sendTouchesForEvent:] + 735
15 UIKit 0x00000001044092c2 -[UIWindow sendEvent:] + 682
16 UIKit 0x00000001043cf581 -[UIApplication sendEvent:] + 246
17 UIKit 0x00000001043dcd1c _UIApplicationHandleEventFromQueueEvent + 18265
18 UIKit 0x00000001043b75dc _UIApplicationHandleEventQueue + 2066
19 CoreFoundation 0x0000000103cb3431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
20 CoreFoundation 0x0000000103ca92fd __CFRunLoopDoSources0 + 269
21 CoreFoundation 0x0000000103ca8934 __CFRunLoopRun + 868
22 CoreFoundation 0x0000000103ca8366 CFRunLoopRunSpecific + 470
23 GraphicsServices 0x00000001085cda3e GSEventRunModal + 161
24 UIKit 0x00000001043ba900 UIApplicationMain + 1282
25 Photo book 0x000000010348b1c7 main + 135
26 libdyld.dylib 0x0000000106965145 start + 1
27 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
this error occurs when you accidently delete iboutlet from your .h file but they are still connected in your xib or storyboard.. make sure that all your iboutlets are connected properly in your second view.
First set you class name as following
Then set segue identifier
And check weather if you have deleted any IBOutlet accidentally or you have change name of controls programatically then respective outlet not found.

iOS Simulator is black on app execution

I am running xcode 5.1.1 and have been trying to learn objective C / iOS development. Right now whenever I try to run my code on the emulator (I do not have an actual device atm) it comes up with a black screen. Code can be found here. Compiling and running gives me the following error:
2014-08-23 10:42:57.429 Calculator[1862:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<XYZViewController 0xe436640> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key didgetPressed.'
*** First throw call stack:
(
0 CoreFoundation 0x017ed1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0156c8e5 objc_exception_throw + 44
2 CoreFoundation 0x0187cfe1 -[NSException raise] + 17
3 Foundation 0x0122cd9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4 Foundation 0x011991d7 _NSSetUsingKeyValueSetter + 88
5 Foundation 0x01198731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6 Foundation 0x011fab0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7 UIKit 0x004e31f4 -[UIRuntimeOutletConnection connect] + 106
8 libobjc.A.dylib 0x0157e7de -[NSObject performSelector:] + 62
9 CoreFoundation 0x017e876a -[NSArray makeObjectsPerformSelector:] + 314
10 UIKit 0x004e1d4d -[UINib instantiateWithOwner:options:] + 1417
11 UIKit 0x0034a6f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
12 UIKit 0x0034ae9d -[UIViewController loadView] + 302
13 UIKit 0x0034b0d3 -[UIViewController loadViewIfRequired] + 78
14 UIKit 0x0034b5d9 -[UIViewController view] + 35
15 UIKit 0x0026b267 -[UIWindow addRootViewControllerViewIfPossible] + 66
16 UIKit 0x0026b5ef -[UIWindow _setHidden:forced:] + 312
17 UIKit 0x0026b86b -[UIWindow _orderFrontWithoutMakingKey] + 49
18 UIKit 0x002763c8 -[UIWindow makeKeyAndVisible] + 65
19 UIKit 0x00226bc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097
20 UIKit 0x0022b667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
21 UIKit 0x0023ff92 -[UIApplication handleEvent:withNewEvent:] + 3517
22 UIKit 0x00240555 -[UIApplication sendEvent:] + 85
23 UIKit 0x0022d250 _UIApplicationHandleEvent + 683
24 GraphicsServices 0x037e2f02 _PurpleEventCallback + 776
25 GraphicsServices 0x037e2a0d PurpleEventCallback + 46
26 CoreFoundation 0x01768ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
27 CoreFoundation 0x017689db __CFRunLoopDoSource1 + 523
28 CoreFoundation 0x0179368c __CFRunLoopRun + 2156
29 CoreFoundation 0x017929d3 CFRunLoopRunSpecific + 467
30 CoreFoundation 0x017927eb CFRunLoopRunInMode + 123
31 UIKit 0x0022ad9c -[UIApplication _run] + 840
32 UIKit 0x0022cf9b UIApplicationMain + 1225
33 Calculator 0x00002c8d main + 141
34 libdyld.dylib 0x01e34701 start + 1
35 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I have attempted the following things, and so far nothing has worked
1) checked the deployment info, it has the main interface set to main
2) double checked all break points to turn them off and disabled all of them through Debug->Disable Breakpoints
3) Reset Content and Settings on the iOS Simulator.
4) Checked the issue with the LLDB Debugger, however from what I have read the issue is no longer present with the 5.1.1 xcode.
5) checked the local host is still set to 127.0.0.1
Thanks!
- Terryn
I checked out your project. The IBActions for the digits (didgetPressed:) are connected correctly, but the IBOutlets are not connected correctly (the property didgetPressed does not exist).
It will work when you delete the referencing outlets in the storyboard (see picture).
This error message tells us what's wrong:
2014-08-23 10:42:57.429 Calculator[1862:60b] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key didgetPressed.'
From this we can deduce that, in your storyboard (or xib), you have an object of class XYZViewController. That object once had an outlet named didgetPressed, and you connected that outlet to something else in the storyboard.
Later, you changed something about your project that removed the didgetPressed outlet from that object, but you didn't disconnect the outlet in your storyboard. For example, maybe you changed the outlet name in your Objective-C code to didGetPressed, or maybe you deleted the outlet and changed it to an action, or maybe you changed the object's class (and the prior class had the didgetPressed outlet).
You need to find the XYZViewController object in your storyboard and disconnect the didgetPressed outlet.
The error is self explanatory you can remove that by opening storyboard select XYZViewController goto connection inspector under Utilities panel and remove binding of didgetPressed.
I have check you code just select button with 7 as title and remove it's referencing outlet and run again it will work.

Resources