Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 7, 2006, 12:56 AM   #1
MacRumoron
macrumors 6502
 
Join Date: Sep 2005
Simple NSMutableDictionary Question

What is the difference between these two methods:

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

- (void)setValue:(id)value forKey:(NSString *)key
Thanks..
__________________
I am the MacRumoron
Click Here For Proof Told you I'm a moron..
MacRumoron is offline   0 Reply With Quote
Old May 7, 2006, 01:10 AM   #2
HexMonkey
Administrator
 
HexMonkey's Avatar
 
Join Date: Feb 2004
Location: New Zealand
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).
HexMonkey is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Modify a key-value pair of an NSMutableDictionary that is represented by an NSData moonman239 iPhone/iPad Programming 1 May 2, 2014 02:56 PM
Simple Question Apple TV [ Thanks ] icloud87 Apple TV and Home Theater 10 Mar 5, 2014 07:29 PM
Simple question?? davidra Apple TV and Home Theater 5 Jan 21, 2014 02:19 PM
NSMutableDictionary and a button to send changes Carll iPhone/iPad Programming 12 Jan 12, 2013 09:19 AM
Resolved: Fetch object in NSMutableDictionary inside NSMutable lasash iPhone/iPad Programming 22 Oct 9, 2012 10:10 PM

Forum Jump

All times are GMT -5. The time now is 05:43 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC