• 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: Cast NSNumber to int
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Cast NSNumber to int
      • From: Philip Vallone <email@hidden>
References: 
 >Cast NSNumber to int (From: Philip Vallone <email@hidden>)

  • Prev by Date: Cast NSNumber to int
  • Next by Date: Re: Cast NSNumber to int
  • Previous by thread: Cast NSNumber to int
  • Next by thread: Re: Cast NSNumber to int
  • Index(es):
    • Date
    • Thread