Recently I have upgraded XCode8 I am facing issue in isKindOfClass
method this code is working till to iOS9
but in iOS10
suddenly [items isKindOfClass: [NSMutableArray class]]
compiler not going in for loop condition may I know what is the reason?
NSMutableArray
is child class of NSArray
so when I am changing to [NSArray class]
then it works fine so I am confuse why this change affect to NSMutableArray
class which is child class of NSArray
?
NSMutableArray *items = [jsonDictionary objectForKey:@"items"]; // Here i am taking response in NSMutableArray
if ([items isKindOfClass: [NSMutableArray class]] && items != nil) // not working {
for (NSMutableDictionary *item in items)
{
// Rest of Code
}
}
This code works for me I m confuse the above code working until iOS9
when I change this below code then after working in iOS10
:
NSMutableArray *items = [jsonDictionary objectForKey:@"items"];
if ([items isKindOfClass: [NSArray class]] && items != nil) // Changed to NSArray {
for (NSMutableDictionary *item in items)
{
// Rest of Code
}
}