When running the below code, the [dict setValue:@"null" forKey:@"name"]; keeps crashing. I search on here and found other posts were caused by people not using NSMutableDictionary. However I am using this.
Why is it crashing on this line if name is null?
NSMutableArray *tempCustomers = [[NSMutableArray alloc] init];
for (NSMutableDictionary *dict in [[json objectForKey:@"data"] mutableCopy]) {
if ([dict objectForKey:@"name"] == [NSNull null]) {
[dict setValue:@"null" forKey:@"name"];
}
[tempCustomers addObject:dict];
}
I ended up using this. I’m guessing this is what a deepMutableCopy is?