I am trying to sort an NSMutableArray for that I am using comparer selector;
- (NSComparisonResult)compare:(Product *)someObject {
return [self.Price compare:someObject.Price];
}
HomeProducts = [HomeProducts sortedArrayUsingSelector:@selector(compare:)];
I want to sort the same array and donot want to assign to other array.
request for member 'Price' in something not a structure or union ....
its not recognizing self.Price.
Assuming that
compare:is in theProductclass then you need to use the console to investigate further.When the exception occurs, what are the values of
selfandsomeObject– I bet that one of them is either not aProductor something that’s been released (I think the latter!)When the crash occurs, you can check the values of self and someObject in the console like this :
(or use the gui to the left of the console).
EDIT Answer to comment :
sortedArrayUsingSelector:returns an NSArray,HomeProductsis an NSMutableArray. Try this instead :