As NSString, NSData, NSDictionary, etc are derived from NSObject, they can
be easily set with -setObject:forKey:, whereas int, float, NSInteger, etc
are scalar types and thus cannot be set with this method. Thus, they have
convenient setters/getters, whereas object types have convenient getters
only. (Why they aren't balanced is beyond me.)
-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/


On Thu, Sep 3, 2009 at 4:05 PM, Oftenwrong Soong
<oftenwrongso...@yahoo.com>wrote:

> Hi all,
>
> Why does NSUserDefaults provide method stringForKey but not a method
> setString:forKey (akin to setBool:forKey, setFloat:forKey, etc.)? This does
> not seem symmetric.
>
> I'm using setObject:forKey when saving a NSString to the defaults database.
> Is this correct?
>
> Thanks,
> Soong
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/steven.degutis%40gmail.com
>
> This email sent to steven.degu...@gmail.com
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to