• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNull vs nil in NSManagedObject setValue: v forKey: k


  • Subject: Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
  • From: Eagle Offshore <email@hidden>
  • Date: Mon, 01 Mar 2010 00:12:40 -0800

Reconcile that with integers and I might buy it.

But in general, KVC requires object wrappers for things you can't put into containers.
NSNull should result in nil when used KVC calls just like NSNumber results in an integer.


On Feb 28, 2010, at 11:53 PM, Alexander Spohr wrote:

>
> 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

  • Follow-Ups:
    • Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
  • Next by Date: Re: action for raise and lower baseline of textview
  • Previous by thread: Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
  • Next by thread: Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
  • Index(es):
    • Date
    • Thread