This might be very basic question but I was wondering why can\'t I assign nil as NSDictionary value? I have following statement many places in my code. If [q objectFor
My friend using nil as marker is a sign of bad programming . nil is reserved for some diffrent purpose .
if([q objectForKey:@"text"] != nil)
[dict setObject:[q objectForKey:@"text"] forKey:@"text"];
else
[dict removeObjectforKey:@"text"]; // this will do nothing if key does not exsist.
//by default for all the keys the value is nil and you are trying to override this behavior. going against the language rules will always get you in trouble .
to check just use
if([dict objectforKey:@"text"] !=nil){} // this will work becuase default value is nil
itself