I am working on a project that uses storyboards and was started in XCode 6 and has been upgraded to XCode 7. I am trying to add a UICollectionViewController. I get an exception on this line: let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! UnsplashCollectionViewCell
I have verified that the controller and cell are both assigned to my custom class in the storyboard, and that my reuse identifier is assigned to the cell and the same as the variable reuseIdentifier in my controller class.
About the only difference I can tell between a working UICollectionViewController and this project's is if I start a new project and add a UICollectionViewController I get the following in the Connections Inspector:
However, the Connections Inspector in my broken project looks like:
I'm not sure this is the problem, but I'm at a loss for what else it could be.
Crash log:
Uncaught exception: could not dequeue a view of kind: UICollectionElementKindCell with identifier UnsplashCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard
Full Crash Log:
2016-03-14 10:34:55.027 PixelSquidTouch[86881:2845927] [Crashlytics] Version 3.4.1 (92)
2016-03-14 10:34:55.063 PixelSquidTouch[86881:] App measurement v.1201000 started
2016-03-14 10:35:02.990 PixelSquidTouch[86881:2845927] *** Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.30.14/UICollectionView.m:3690
2016-03-14 10:35:03.013 PixelSquidTouch[86881:2845927] WARNING: GoogleAnalytics 3.14 void GAIUncaughtExceptionHandler(NSException *) (GAIUncaughtExceptionHandler.m:48): Uncaught exception: could not dequeue a view of kind: UICollectionElementKindCell with identifier UnsplashCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard
2016-03-14 10:35:08.054 PixelSquidTouch[86881:2845927] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier UnsplashCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
*** First throw call stack:
(
0 CoreFoundation 0x000000010c95ce65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010ffb0deb objc_exception_throw + 48
2 CoreFoundation 0x000000010c95ccca +[NSException raise:format:arguments:] + 106
3 Foundation 0x000000010fa274de -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 UIKit 0x000000010ddd04e9 -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] + 2009
5 UIKit 0x000000010ddd0945 -[UICollectionView dequeueReusableCellWithReuseIdentifier:forIndexPath:] + 169
6 PixelSquidTouch 0x000000010b8d9e6a _TFC15PixelSquidTouch32UnsplashCollectionViewController14collectionViewfS0_FTCSo16UICollectionView22cellForItemAtIndexPathCSo11NSIndexPath_CSo20UICollectionViewCell + 122
7 PixelSquidTouch 0x000000010b8d9f8f _TToFC15PixelSquidTouch32UnsplashCollectionViewController14collectionViewfS0_FTCSo16UICollectionView22cellForItemAtIndexPathCSo11NSIndexPath_CSo20UICollectionViewCell + 79
8 UIKit 0x000000010ddc05ba -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:] + 483
9 UIKit 0x000000010ddc2ae0 -[UICollectionView _updateVisibleCellsNow:] + 4431
10 UIKit 0x000000010ddc723b -[UICollectionView layoutSubviews] + 247
11 UIKit 0x000000010d6224a3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
12 QuartzCore 0x000000010f41759a -[CALayer layoutSublayers] + 146
13 QuartzCore 0x000000010f40be70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
14 QuartzCore 0x000000010f40bcee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
15 QuartzCore 0x000000010f400475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
16 QuartzCore 0x000000010f42dc0a _ZN2CA11Transaction6commitEv + 486
17 UIKit 0x000000010d596b47 _afterCACommitHandler + 174
18 CoreFoundation 0x000000010c888367 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
19 CoreFoundation 0x000000010c8882d7 __CFRunLoopDoObservers + 391
20 CoreFoundation 0x000000010c87df2b __CFRunLoopRun + 1147
21 CoreFoundation 0x000000010c87d828 CFRunLoopRunSpecific + 488
22 GraphicsServices 0x000000011197cad2 GSEventRunModal + 161
23 UIKit 0x000000010d56b610 UIApplicationMain + 171
24 PixelSquidTouch 0x000000010b957aad main + 109
25 libdyld.dylib 0x0000000110b5692d start + 1
26 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
So, you are trying to dequeue a cell but there is no cell with that ID. You need to open the cell in the storyboard or Xib and set the UICollectionElementKindCell ID to that id UnsplashCell
If you havent done the cell in the storyboard as a prototype cell, but are using a xib file, then you also need to register that cell with the tableview, so it knows about the cell type.
in your viewDidLoad:
let nibName = UINib(nibName: "UICollectionElementKindCell", bundle:nil)
self.tableView.registerNib(nibName, forCellReuseIdentifier: "UnsplashCell")
Update:
Look at the objects outlets etc. in the storyboard with the VC selected.
I am also struggling with this same issue since upgrading to XCode 7 last week. In our case, we were disabling user interaction whenever we displayed an activity view:
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
Then, in a callback block we were re-enabling user interaction with this:
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
Removing these calls resolved three out of four of these issues in our code; hopefully it can fix your issue as well. In any event, we haven't come up with a better approach as of yet.
Related
I am creating an app with a UITableViewController but I am getting the error:
'unable to dequeue a cell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
I don't understand how I to find the solution and fix it.
2018-09-15 01:28:28.609848+0300 Yemekler[6554:482441] *** Assertion failure in -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.54.4/UITableView.m:7879
2018-09-15 01:28:28.613237+0300 Yemekler[6554:482441] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
*** First throw call stack:
(
0 CoreFoundation 0x0000000112f461e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x000000010f3ac031 objc_exception_throw + 48
2 CoreFoundation 0x0000000112f4b472 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010ee4f652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x000000010fd8a496 -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:] + 879
5 UIKit 0x000000010fd8a0f3 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 91
6 Yemekler 0x000000010ea9de72 _T08Yemekler17YemekTarifleriTVCC9tableViewSo07UITableF4CellCSo0gF0C_10Foundation9IndexPathV12cellForRowAttF + 226
7 Yemekler 0x000000010ea9e34c _T08Yemekler17YemekTarifleriTVCC9tableViewSo07UITableF4CellCSo0gF0C_10Foundation9IndexPathV12cellForRowAttFTo + 92
8 UIKit 0x000000010fda5567 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 783
9 UIKit 0x000000010fda5ae4 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
10 UIKit 0x000000010fd6ceaa -[UITableView _updateVisibleCellsNow:isRecursive:] + 3168
11 UIKit 0x000000010fd8d7e0 -[UITableView layoutSubviews] + 176
12 UIKit 0x000000010fd177a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1515
13 QuartzCore 0x00000001166b5456 -[CALayer layoutSublayers] + 177
14 QuartzCore 0x00000001166b9667 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
15 QuartzCore 0x00000001166400fb _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 343
16 QuartzCore 0x000000011666d79c _ZN2CA11Transaction6commitEv + 568
17 UIKit 0x000000010fc62269 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 141
18 CoreFoundation 0x0000000112ee8b0c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
19 CoreFoundation 0x0000000112ecd2db __CFRunLoopDoBlocks + 331
20 CoreFoundation 0x0000000112ecca84 __CFRunLoopRun + 1284
21 CoreFoundation 0x0000000112ecc30b CFRunLoopRunSpecific + 635
22 GraphicsServices 0x000000011583ea73 GSEventRunModal + 62
23 UIKit 0x000000010fc48057 UIApplicationMain + 159
24 Yemekler 0x000000010ea9c077 main + 55
25 libdyld.dylib 0x0000000114127955 start + 1
26 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
You need to register the table with a cell before dequeue in viewDidLoad with xib
tableView.register(UINib(nibName: "TableCell", bundle: nil), forCellReuseIdentifier: "cell")
OR
tableView.register(TableCell.self, forCellReuseIdentifier: "cell")
It's clear here from the crash
unable to dequeue a cell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
As #Sh_Khan pointed out. You can register the cell in code or you can also register the reuse identifier in Storyboard, if you are using prototype cells.
I am using Xib file as a custom Tableview Cell. But everytime i run my application, it crashes. I get this crash logs which i posted below
* Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.7.47/UITableView.m:6730
2017-12-04 17:23:16.070 iCommander[2489:135476] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
*** First throw call stack:
(
0 CoreFoundation 0x00000001035f6b0b exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010305b141 objc_exception_throw + 48
2 CoreFoundation 0x00000001035facf2 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000102bf5536 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x00000001042eae45 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 241
5 iCommander 0x0000000101e6b43f _TFC10iCommander25CommentsHistoryController9tableViewfTCSo11UITableView12cellForRowAtV10Foundation9IndexPath_CSo15UITableViewCell + 303
6 iCommander 0x0000000101e6ba07 _TToFC10iCommander25CommentsHistoryController9tableViewfTCSo11UITableView12cellForRowAtV10Foundation9IndexPath_CSo15UITableViewCell + 87
7 UIKit 0x00000001042fdab2 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 750
8 UIKit 0x00000001042fdcf8 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
9 UIKit 0x00000001042d2639 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2845
10 UIKit 0x0000000104306ccc -[UITableView _performWithCachedTraitCollection:] + 111
11 UIKit 0x00000001042ede7a -[UITableView layoutSubviews] + 233
12 UIKit 0x000000010425455b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1268
13 QuartzCore 0x0000000102429904 -[CALayer layoutSublayers] + 146
14 QuartzCore 0x000000010241d526 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 370
15 QuartzCore 0x000000010241d3a0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
16 QuartzCore 0x00000001023ace92 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
17 QuartzCore 0x00000001023d9130 _ZN2CA11Transaction6commitEv + 468
18 QuartzCore 0x00000001023d9b37 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 115
19 CoreFoundation 0x000000010359c717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
20 CoreFoundation 0x000000010359c687 __CFRunLoopDoObservers + 391
21 CoreFoundation 0x0000000103581720 __CFRunLoopRun + 1200
22 CoreFoundation 0x0000000103581016 CFRunLoopRunSpecific + 406
23 GraphicsServices 0x00000001091e1a24 GSEventRunModal + 62
24 UIKit 0x0000000104191134 UIApplicationMain + 159
25 iCommander 0x0000000101e13ea7 main + 55
26 libdyld.dylib 0x000000010743e65d start + 1
27 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Please help. Thanks in advance.
You forgot to register the XIB file. You have to register the xib file for getting rid of the crash.
In Swift 3
let xib = UINib(nibName: "YourCustomCell", bundle: nil)
tableView.register(xib, forCellReuseIdentifier: "Cell")
You should register the custom cell like that.
Hope it helps.
Set cell identifier to custom cell in xib file as:
IN Swift 3
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = Bundle.main.loadNibNamed("XibName", owner: self, options: nil)?.first as! XibName
return cell
}
edit: I solved the problem by disabling Accessibility option from UITextField's identifier window. I really don't understand how this solved my problem.
I'm following Stanford University CS193p Swift course online and I tried to write the code that was written during lecture 9 and I've encountered an error. The project I'm trying to do is a simple Twitter client app. There is a UITableViewController and app runs without any problem. When I added a UITextField on top of UITableView, app launches fine but when I touch the screen I have this error message on console:
2017-01-31 22:02:48.152 Smashtag[39223:3430950] -[UIAccessibilityTextFieldElement convertPoint:fromView:]: unrecognized selector sent to instance 0x6180000519a0
2017-01-31 22:02:48.156 Smashtag[39223:3430950] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIAccessibilityTextFieldElement convertPoint:fromView:]: unrecognized selector sent to instance 0x6180000519a0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010a605d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010a06721e objc_exception_throw + 48
2 CoreFoundation 0x000000010a675f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010a58b005 ___forwarding___ + 1013
4 CoreFoundation 0x000000010a58ab88 _CF_forwarding_prep_0 + 120
5 UIAccessibility 0x000000011debdddb -[NSObject(AXPrivCategory) _accessibilityHitTestSupplementaryViews:point:withEvent:] + 477
6 UIKit 0x000000011dd3572a -[UITableViewAccessibility _accessibilityHitTest:withEvent:] + 173
7 UIKit 0x000000011dd4eb2b -[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1859
8 UIKit 0x000000011dd4f979 -[UIViewAccessibility _accessibilityHitTest:withEvent:] + 101
9 UIKit 0x000000011dd4eb2b -[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1859
10 UIKit 0x000000011dd4f979 -[UIViewAccessibility _accessibilityHitTest:withEvent:] + 101
11 UIKit 0x000000011dd4eb2b -[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1859
12 UIKit 0x000000011dd4f979 -[UIViewAccessibility _accessibilityHitTest:withEvent:] + 101
13 UIKit 0x000000011dd4eb2b -[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1859
14 UIKit 0x000000011dd4f979 -[UIViewAccessibility _accessibilityHitTest:withEvent:] + 101
15 UIKit 0x000000011dd67e34 -[UIWindowAccessibility _accessibilityHitTest:withEvent:] + 101
16 UIAccessibility 0x000000011deb137f _copyElementAtPositionCallback + 1722
17 AXRuntime 0x000000011cea7955 _AXXMIGCopyElementAtPosition + 169
18 AXRuntime 0x000000011cea1aab _XCopyElementAtPosition + 311
19 AXRuntime 0x000000011ceb0de5 mshMIGPerform + 266
20 CoreFoundation 0x000000010a5973d9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
21 CoreFoundation 0x000000010a597351 __CFRunLoopDoSource1 + 465
22 CoreFoundation 0x000000010a58f435 __CFRunLoopRun + 2389
23 CoreFoundation 0x000000010a58e884 CFRunLoopRunSpecific + 420
24 GraphicsServices 0x000000010f769a6f GSEventRunModal + 161
25 UIKit 0x000000010aa29c68 UIApplicationMain + 159
26 Smashtag 0x0000000109a3406f main + 111
27 libdyld.dylib 0x000000010dead68d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I checked the outlet connections and I think there is no wrong connection or something similar. How can I solve this problem?
I encountered the exact same issue. I found that any time I had a UITextField in the header of a UITableView, trying to interact with my app on the simulator would crash with that same exception.
After much flailing around, I eventually thought to disable BetterTouchTool (version 2.071).
Without BetterTouchTool running, I no longer encounter that issue.
I haven't looked further into what functionality or settings in BetterTouchTool might be to blame
I also met the same problem today.I set tableHeaderView for UITableView into a UITextField
_tableView.tableHeaderView = self.rechargeTextField;
And then I click the app screen will collapse.
Repeatedly collapse after I realized
[UIAccessibilityTextFieldElement convertPoint: fromView:] :
may be tableHeaderView set UITextField at frame dynamic changed.
I've added a UIView hederView inheritance, hederView addSubview the UITextField at that time.
[_headerView addSubview:_rechargeTextField];
And then set
_tableView.tableHeaderView = self.headerView;
Is solved.
I have listing of videos in UITableView which uses custom class. This is tabbar application. When I scroll down to 8th video, and go to next screen and when I come back to video listing screen, the app crashes. I tried to debug but cannot figure out the issue. This is what I get from debugger.
2016-06-08 12:47:46.919 Votocast[2283:453809] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 8 beyond bounds for empty array'
*** First throw call stack:
(
0 CoreFoundation 0x0000000108ba9d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010a7f9deb objc_exception_throw + 48
2 CoreFoundation 0x0000000108a87804 -[__NSArrayM objectAtIndex:] + 212
3 Votocast 0x0000000107dfd4de -[HomeView tableView:cellForRowAtIndexPath:] + 958
4 UIKit 0x000000010b6914f4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 766
5 UIKit 0x000000010b69162c -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
6 UIKit 0x000000010b665c8a -[UITableView _updateVisibleCellsNow:isRecursive:] + 2799
7 UIKit 0x000000010b69a686 -[UITableView _performWithCachedTraitCollection:] + 92
8 UIKit 0x000000010b681344 -[UITableView layoutSubviews] + 224
9 UIKit 0x000000010b5ee980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
10 QuartzCore 0x0000000109ff1c00 -[CALayer layoutSublayers] + 146
11 QuartzCore 0x0000000109fe608e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
12 QuartzCore 0x0000000109fe5f0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
13 QuartzCore 0x0000000109fda3c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
14 QuartzCore 0x000000010a008086 _ZN2CA11Transaction6commitEv + 486
15 UIKit 0x000000010b52e72e _UIApplicationHandleEventQueue + 7135
16 CoreFoundation 0x0000000108acf301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x0000000108ac522c __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x0000000108ac46e3 __CFRunLoopRun + 867
19 CoreFoundation 0x0000000108ac40f8 CFRunLoopRunSpecific + 488
20 GraphicsServices 0x000000010d4ebad2 GSEventRunModal + 161
21 UIKit 0x000000010b533f09 UIApplicationMain + 171
22 Votocast 0x0000000107e48d8f main + 111
23 libdyld.dylib 0x000000010cc0792d start + 1
24 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
In viewWillAppear, I remove all objects from this array and call webservice. But before I get response from webservice, app crashes to a line in cellForRowAtIndexPath. Your little help will be appreciated.
EDIT:
I have noticed that app only crashes when my tableview decelerationrate and I go to next screen and comeback to video listing screen. I have not done any type of code regarding decelerationration.
Clearly your datasource delegate isn't working properly. If you empty an array that is used by the datasource, then you must call reloadData. And when you get new data, you call reloadData again.
However, you shouldn't refresh data that way. You should display the old data until new data arrives.
You Clear all the object From Array in viewWillAppear Method But, do you Reload the tableview after that.
because this can cause the crash. you remove all the object but tableview tries to goto the last scrolled index. so it cause the crash.
Hope this will help You.
Thank you guys. I fixed it. I actually was allocating array in viewDidLoad and was just removing objects from that array in viewWillAppear. So I preserve my data and not calling webservice in viewWillAppear.
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.