Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
- Subject: Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
- From: Alexander Spohr <email@hidden>
- Date: Mon, 1 Mar 2010 08:53:17 +0100
Am 01.03.2010 um 08:12 schrieb Eagle Offshore:
> NSManagedObject* obj; // gets created somehow
>
> [obj setValue: nil forKey: @"bar"]; // succeeds where NSDictionary fails
> [obj setValue: [NSNull null] forKey: @"bar"]; // fails where NSDictionary succeeds
>
> so - this is conceptually buggy thinking and the thoughtful developer could be forgiven for being VERY SURPRISED by this behavior that is NOT DOCUMENTED.
Wat if you use subclasses of NSManagedObject as I always do?
[obj setBar:[NSNull null]] // has to fail, I need a string!
Your comparison to NSDictionary is wrong. NSManagedObject is a (good working) placeholder for a class with properties and not just a container like NSDictionary.
If you build a method that takes an NSString you would not want NSNull in it, do you?
atze
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden