• 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: NSDatePicker and NSNull
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDatePicker and NSNull


  • Subject: Re: NSDatePicker and NSNull
  • From: Daniel Eggert <email@hidden>
  • Date: Sat, 23 Sep 2006 19:40:54 +0200

On Sep 23, 2006, at 12:35 AM, Tore Halset wrote:

Hello.

I have a Dictionary with different property values for an entity. One of the values are a date, but it can be NSNull. NSDatePicker does not handle the null-value and give the following error message:

Cannot create date from object <null> of class NSNull

What is a good way to handle this situation. Should I have a check box for "has date". Setting it set the default date to something and enables the date picker. Unsetting it disable the date picker. Any other solution?

Regards,
 - Tore.

Why do you use a dictionary? A more object oriented approach would be to have a class for you entity (call it Entity if you like).


This way you can handle your NSDate picker gracefully. If you then need an NSDictionary for some reason, just have a method in your class, that encodes it to a dictionary.

/Daniel



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSDatePicker and NSNull (From: Tore Halset <email@hidden>)

  • Prev by Date: [IBPalette] inspectorClassName returns (null)
  • Next by Date: Scrolling NSOutlineView makes attributed string bold
  • Previous by thread: NSDatePicker and NSNull
  • Next by thread: Cocoa dialog in CarbonLib App
  • Index(es):
    • Date
    • Thread