Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MacRumoron

macrumors 6502
Original poster
Sep 6, 2005
324
0
What is the difference between these two methods:

Code:
- (void)setObject:(id)anObject forKey:(id)aKey

- (void)setValue:(id)value forKey:(NSString *)key

Thanks..
 
The main difference is that setValue will accept a nil parameter for the object value (in which case it will remove the key from the dictionary), but setObject won't (it will throw an exception). Also, setValue will only work in Mac OS X 10.3 and higher while setObject works in older versions of Mac OS X. Other than that, they're essentially the same (in fact setValue just calls setObject after checking for a nil parameter).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.