Re: Cast NSNumber to int
Re: Cast NSNumber to int
- Subject: Re: Cast NSNumber to int
- From: Philip Vallone <email@hidden>
- Date: Sat, 28 Nov 2009 06:36:09 -0500
Thanks for the quick response. Works like a charm!
On Nov 28, 2009, at 6:26 AM, Andrew Farmer wrote:
> 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