Re: Cast NSNumber to int
Re: Cast NSNumber to int
- Subject: Re: Cast NSNumber to int
- From: Andrew Farmer <email@hidden>
- Date: Sat, 28 Nov 2009 03:26:27 -0800
On 28 Nov 2009, at 03:20, Philip Vallone wrote:
> I want to cast a NSNumber to int. When I execute the below code, my result should be 1, not 68213232. What am I doing wrong?
You are trying to cast a pointer to an integer and expecting meaningful results. Don't.
If you want to get the numeric value of a NSNumber object, use its intValue (or floatValue, longValue, etc.) method._______________________________________________
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