On Dec 15, 2014, at 4:10 PM, Kevin Bracey <ke...@ilike.co.nz> wrote: > I'm needing to read in a PList, that others have designed, I have no control > over the input. > > One of the Keys stores either a String, Number or Boolean value. > > Checking for the NSString is straight forward. > > How can I tell if the Value is a Boolean or Number in the NSDictionary? as 0 > and 1 are valid values for a number.
In Cocoa, both booleans and numbers are represented by NSNumber. In Core Foundation, there are distinct types, CFBoolean and CFNumber. NSNumber and CFNumber are toll-free bridged, but there's no similar guarantee about NSNumber and CFBoolean. The most reliable solution may be to use Core Foundation to deserialize the property list. See CFPropertyList <https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFPropertyListRef/index.html>. For any given object in the resulting property list, you can check its type using the standard mechanism for CFTypes. Call CFGetTypeID() on the object and then compare the result to CFBooleanGetTypeID(), CFNumberGetTypeID(), etc. Regards, Ken _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com