-3

I'm getting this crash. Here is my crash reason. I didn't understand what I am doing.

 reason: '*** -[__NSArrayM objectAtIndex:]: index 2 beyond bounds for empty array'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x036131e4 __exceptionPreprocess + 180
        1   libobjc.A.dylib                     0x02c1c8e5 objc_exception_throw + 44
        2   CoreFoundation                      0x035b43f6 -[__NSArrayM objectAtIndex:] + 246
        3   Stampd                              0x0007e928 -[VenueProfile tableView:cellForRowAtIndexPath:] + 472
        4   UIKit                               0x017c811f -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 412
        5   UIKit                               0x017c81f3 -[UITableView _createPreparedCellForGlobalRow:] + 69
        6   UIKit                               0x017a9ece -[UITableView _updateVisibleCellsNow:] + 2428
        7   UIKit                               0x017be6a5 -[UITableView layoutSubviews] + 213
        8   UIKit                               0x0173e964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
        9   libobjc.A.dylib                     0x02c2e82b -[NSObject performSelector:withObject:] + 70
        10  QuartzCore                          0x0055945a -[CALayer layoutSublayers] + 148
        11  QuartzCore                          0x0054d244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
        12  QuartzCore                          0x0054d0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
        13  QuartzCore                          0x004b37fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
        14  QuartzCore                          0x004b4b85 _ZN2CA11Transaction6commitEv + 393
        15  QuartzCore                          0x00581cc6 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 474
        16  QuartzCore                          0x00582147 _ZN2CA7Display16TimerDisplayLink8callbackEP16__CFRunLoopTimerPv + 123
        17  CoreFoundation                      0x035d1ac6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
        18  CoreFoundation                      0x035d14ad __CFRunLoopDoTimer + 1181
        19  CoreFoundation                      0x035b9538 __CFRunLoopRun + 1816
        20  CoreFoundation                      0x035b89d3 CFRunLoopRunSpecific + 467
        21  CoreFoundation                      0x035b87eb CFRunLoopRunInMode + 123
        22  GraphicsServices                    0x03bdb5ee GSEventRunModal + 192
        23  GraphicsServices                    0x03bdb42b GSEventRun + 104
        24  UIKit                               0x016cff9b UIApplicationMain + 1225
        25  Stampd                              0x000044e2 main + 130
        26  libdyld.dylib                       0x0431d701 start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
3
  • Your array is empty and you are trying to access its 2nd element Commented Jun 4, 2014 at 11:53
  • Can you add some code? It looks like tableView:cellForRowAtIndexPath: is trying to access an empty array or something like this. Commented Jun 4, 2014 at 11:55
  • This error is objectiveC 101. Google it man "nsmutablearray beyond bounds for empty array" Commented Jun 4, 2014 at 13:44

2 Answers 2

1

The error

[__NSArrayM objectAtIndex:]: index 2 beyond bounds for empty array

clearly states that, trying to access the empty array. Check the array as alloc & init and has objects in it

Sign up to request clarification or add additional context in comments.

Comments

0

Put your array in NSLog at the method numberOfRowsInSection. This will give you objects in the array and if array is empty please check if you initialize your array properly. If not, alloc and init your array before adding objects into it.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.