Search code examples
iosobjective-cunrecognized-selectornsexception

Error message when launching my app


EDIT : I found the solution, here is the answer :

UITableViewCell indexPath crash in iOS7

Thanks !

I am using Xcode 5.1.1, on the simulator 7.0. When I launch my application, I have an error that crashes my app. Here is the error message :

2014-04-28 15:06:45.144 OpenSeriesMercedesFrance[7817:70b] -[UITableViewWrapperView     cellForRowAtIndexPath:]: unrecognized selector sent to instance 0xadcce00
2014-04-28 15:06:45.146 OpenSeriesMercedesFrance[7817:70b] *** Terminating app due to uncaught  exception 'NSInvalidArgumentException', reason: '-[UITableViewWrapperView cellForRowAtIndexPath:]: unrecognized selector sent to instance 0xadcce00'
*** First throw call stack:
(
0   CoreFoundation                      0x03a085e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x02fbe8b6 objc_exception_throw + 44
2   CoreFoundation                      0x03aa5903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3   CoreFoundation                      0x039f890b ___forwarding___ + 1019
4   CoreFoundation                      0x039f84ee _CF_forwarding_prep_0 + 14
5   OpenSeriesMercedesFrance            0x000524b2 +[Rules changeCell:atIndexPath:forRow:inSection:inFormDictionary:] + 354
6   OpenSeriesMercedesFrance            0x00051cdf +[Rules checkRule:atIndexPath:inFormDictionary:] + 911
7   OpenSeriesMercedesFrance            0x00154a8d -[MainViewController showFormScrollView] + 861
8   OpenSeriesMercedesFrance            0x00158986 -[MainViewController countrySelected:isDefaultCountry:] + 582
9   OpenSeriesMercedesFrance            0x00137055 -[CountryTableViewController tableView:didSelectRowAtIndexPath:] + 565
10  UIKit                               0x00db77b1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513
11  UIKit                               0x00db7924 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
12  UIKit                               0x00dbb908 __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
13  UIKit                               0x00cf2183 ___afterCACommitHandler_block_invoke + 15
14  UIKit                               0x00cf212e _applyBlockToCFArrayCopiedToStack + 403
15  UIKit                               0x00cf1f5a _afterCACommitHandler + 532
16  CoreFoundation                      0x039d04ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
17  CoreFoundation                      0x039d041f __CFRunLoopDoObservers + 399
18  CoreFoundation                      0x039ae344 __CFRunLoopRun + 1076
19  CoreFoundation                      0x039adac3 CFRunLoopRunSpecific + 467
20  CoreFoundation                      0x039ad8db CFRunLoopRunInMode + 123
21  GraphicsServices                    0x03c959e2 GSEventRunModal + 192
22  GraphicsServices                    0x03c95809 GSEventRun + 104
23  UIKit                               0x00cd5d3b UIApplicationMain + 1225
24  OpenSeriesMercedesFrance            0x00029b7d main + 125
25  libdyld.dylib                       0x0355a701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

I don't really understand that message. When I check on other messages (when I google it, I find some people that has the same type of problems, and they say to look in the connection inspector. May be there is a button that has been removed, but I cannot see nothing...).


Solution

  • The class you set to be tableView delegate doesn't implement cellForRowAtIndexPath: method - which is required.

    Try with default one (add this to your class where you create table):

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
    
    return cell;
    }