Xcode automatically converts the object to NSArray
Posted
by
Farrukh Javeid
on Stack Overflow
See other posts from Stack Overflow
or by Farrukh Javeid
Published on 2013-06-26T09:53:44Z
Indexed on
2013/06/26
10:21 UTC
Read the original article
Hit count: 182
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
}
© Stack Overflow or respective owner