How will I be able to remove [NSNull Null] objects from NSMutableArray?

Heena picture Heena · Feb 8, 2012 · Viewed 8.6k times · Source

I need to remove Null object added by

 [mutArrSkills addObject:[NSNull null]];

Do I need to iterate? Is there any function to remove all null values from NSMutableArray?

If need to Iterate, how will I do that?

Answer

Ilanchezhian picture Ilanchezhian · Feb 8, 2012

You can use NSMutableArray's removeObjectIdenticalTo: method, as follows

[mutArrSkills removeObjectIdenticalTo:[NSNull null]];

to remove the null values. No need to iterate.