NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 5 beyond bounds for empty array'

Reason: You are accessing Empty array about to access object at index.

replace all places like in your code below

[arrMydata objectAtIndex:indexPath.row];

with

 //1. Positive index ([anArray objectAtIndex:-NUMBERS]) will crash

 //2. within the array boundary

 if([arrMydata count] > 0 && [arrMydata count] > indexPath.row){

    shrObj=[arrMydata objectAtIndex:indexPath.row];

 }
 else{

    //Array is empty,handle as you needed

 }

**Here You can see the non software example, which will explain this issue. Good luck! **


You array is empty, but you're trying to access an object in it. That is the problem.


Reason: According to your log, you're trying to access empty array. Just fix this by below code

if (arrMydata.count > inxexPath.row)
    sharObj = [arrMydata objectAtIndex:indexPath.row]