Xcode Error

Discussion in 'iOS Programming' started by rebner, Jan 26, 2014.

  1. rebner macrumors newbie

    Joined:
    Jan 26, 2014
    #1
    Hello, I am new to Xcode and I keep getting this error and I am not quite sure what it means and how to fix it


    2014-01-26 00:23:16.183 SidebarDemo[677:70b] *** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-2903.23/UITableView.m:5261
    2014-01-26 00:23:16.186 SidebarDemo[677:70b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier map - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
    *** First throw call stack:
    (
    0 CoreFoundation 0x0222a5e4 __exceptionPreprocess + 180
    1 libobjc.A.dylib 0x016a48b6 objc_exception_throw + 44
    2 CoreFoundation 0x0222a448 +[NSException raise:format:arguments:] + 136
    3 Foundation 0x01077fee -[NSAssertionHandler handleFailureInMethod:eek:bject:file:lineNumber:description:] + 116
    4 UIKit 0x002e9ed3 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 170
    5 SidebarDemo 0x0000d6e9 -[SidebarViewController tableView:cellForRowAtIndexPath:] + 233
    6 UIKit 0x002f461f -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 412
    7 UIKit 0x002f46f3 -[UITableView _createPreparedCellForGlobalRow:] + 69
    8 UIKit 0x002d8774 -[UITableView _updateVisibleCellsNow:] + 2378
    9 UIKit 0x002ebe95 -[UITableView layoutSubviews] + 213
    10 UIKit 0x00270267 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
    11 libobjc.A.dylib 0x016b681f -[NSObject performSelector:withObject:] + 70
    12 QuartzCore 0x029ed2ea -[CALayer layoutSublayers] + 148
    13 QuartzCore 0x029e10d4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    14 QuartzCore 0x029e0f40 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
    15 QuartzCore 0x02948ae6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
    16 QuartzCore 0x02949e71 _ZN2CA11Transaction6commitEv + 393
    17 QuartzCore 0x02a06430 +[CATransaction flush] + 52
    18 UIKit 0x00221dc9 _afterCACommitHandler + 131
    19 CoreFoundation 0x021f24ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    20 CoreFoundation 0x021f241f __CFRunLoopDoObservers + 399
    21 CoreFoundation 0x021d0344 __CFRunLoopRun + 1076
    22 CoreFoundation 0x021cfac3 CFRunLoopRunSpecific + 467
    23 CoreFoundation 0x021cf8db CFRunLoopRunInMode + 123
    24 GraphicsServices 0x027c59e2 GSEventRunModal + 192
    25 GraphicsServices 0x027c5809 GSEventRun + 104
    26 UIKit 0x00205d3b UIApplicationMain + 1225
    27 SidebarDemo 0x0000c76d main + 141
    28 libdyld.dylib 0x0386a70d start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    (lldb)



    Thank you to all who help in advance!
     
  2. MacMan988 macrumors 6502a

    Joined:
    Jul 7, 2012
    #2
    What do you have in the
    Code:
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    method?
     
  3. rebner, Jan 26, 2014
    Last edited by a moderator: Jan 26, 2014

    rebner thread starter macrumors newbie

    Joined:
    Jan 26, 2014
    #3

    I have:
    Code:
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        NSString *CellIdentifier = [self.menuItems objectAtIndex:indexPath.row];
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
        
        return cell;
    }
    
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Have you created a cell with that identifier?
     
  5. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #5
    Your code suggests that you are using a different identifier for each cell in your table view. That's wrong, and a bad idea even if it's intentional.

    The more often the table view is able to recycle an already-built cell, the faster and more memory efficient your table view will be.

    You want a unique identifier for each unique TYPE of cell in your table view. If you have 3 sections of cells, say and the first section displays pairs of pictures, the second section displays 3 labels, and the third section displays a larger picture and a text view, you would have a unique identifier for each of the 3 types of cells.

    Where are your cells defined? What identifier are you using?
     
  6. rebner thread starter macrumors newbie

    Joined:
    Jan 26, 2014
    #6
    I am new to all of this and was following a tutorial on creating a side view menu.

    This is what the storyboard and delegates look like:
    [​IMG]

    My full code for the MainViewController.m is located here:
    http://pastebin.com/avAEAduD
     

    Attached Files:

  7. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #7
    What tutorial? (link?)

    I'm not going to download your code. That sounds too much like work.
     
  8. rebner thread starter macrumors newbie

    Joined:
    Jan 26, 2014
    #8

Share This Page