• 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: Problem with numbers and property lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with numbers and property lists


  • Subject: Re: Problem with numbers and property lists
  • From: Chris Kane <email@hidden>
  • Date: Sun, 29 Dec 2002 16:50:22 -0800

On Wednesday, December 25, 2002, at 10:00 AM, Nicola Vitacolonna wrote:
Nobody having problems with NS(Decimal)Numbers and property lists?
I have an NSTable that displays formatted real numbers (cells have an
NSFormatter attached).
[...]
Please help me, because this is somewhat frustrating. Should
NSDecimalNumbers be property list objects, in that they are a subclass
of NSNumber? Or am I assuming something wrong?

You can check the property-list-ness of an object (say, the top-level of your plist) using the NSPropertyListSerialization class in 10.2. If your NSDecimalNumbers are not accepted as number objects (and they probably should be), that's the problem. If they are accepted, they are still going to be subject to two effects: (1) loss of precision and actual value for very large or small values, outside the ordinary range of a double NSNumber, and (2) when the objects are recreated from the flattened form, they will be NSNumbers not NSDecimalNumbers (plist serialization does not preserve class).

Archiving is also a solution for your the pasteboard. Instead of using setPropertyList:forType: you should archive to an NSData and use setData:forType: (and of course dataForType: on the read end).


Chris Kane
Cocoa Frameworks, Apple
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Problem with numbers and property lists (From: Nicola Vitacolonna <email@hidden>)

  • Prev by Date: Custom sheets without going application modal?
  • Next by Date: Re: Custom sheets without going application modal?
  • Previous by thread: Problem with numbers and property lists
  • Next by thread: NSFileManager and -fileManager:shouldProceedAfterError:
  • Index(es):
    • Date
    • Thread