On Sat, 19 Feb 2011 17:17:36 -0500, Michael Crawford <[email protected]> 
said:
>I'm trying to compare instances of NSNumber using NSSet.  I have a set of 
>numbers, which represent 64-bit persistent IDs for iTunes media-items.  I 
>access these values using the -[NSNumber longLongValue] method.

You're having a fundamental numerics mismatch. The problem is that the 64-bit 
persistent IDs for iTunes media items are not long long, so reading them with 
longLongValue will give you the wrong answer. They are *unsigned* long long, 
which is a different animal.

This matter has been discussed fairly extensively on StackOverflow. My own 
preference for reading these items is to leave them as NSNumber wherever 
possible; if I need an alternative representation, I pass them through @"%@" as 
a string format, which results in a string that does the right thing. See also:

http://stackoverflow.com/questions/1181637/storing-and-retrieving-unsigned-long-long-value-to-from-nsstring

m.

--
matt neuburg, phd = [email protected], <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to