I have been working on an app and during the development, I am facing a very strange problem. I have a NSMutableArray tempSortedArray, which is full of objects of Store types. All the objects are valid as I can see them in my GUI, the problem arises when I iterate through the array, at index 90, which can be generally anyone, the XCode converts the Store object to NSMutableArray object.
Any idea, why this is happening. This is the code to check out what I am doing:
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"cashBack"
ascending:NO];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSArray *sortedArray = [storesArray sortedArrayUsingDescriptors:sortDescriptors];
for (int i = 0; i < [tempSortedArray count]; i++) {
Store *currentStore = [tempSortedArray objectAtIndex:i];
NSLog(@"store class: %@", [currentStore.class description]);
if (currentStore.cashBackTypeString != (id)[NSNull null]) {
//do whatever is required to do here
}