Dynamically populate object properties with dictionary values
问题 In Objective-C, I have a dictionary: firstName -> John lastName -> Smith age -> 34 and an object Person that has corresponding instance variables and properties (that handle memory management appropriately). I'd like to create a convenience initializer that takes a dictionary as an argument and populates all the object fields (via their properties for memory management purposes) from the dictionary keys/values, instead of manually doing something like: obj.firstName = [dict objectForKey:@