• 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
NSUserDefault and Negative numerical arguments (Was: Posting mouse clicks with multiple displays)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUserDefault and Negative numerical arguments (Was: Posting mouse clicks with multiple displays)


  • Subject: NSUserDefault and Negative numerical arguments (Was: Posting mouse clicks with multiple displays)
  • From: DeNigris Sean <email@hidden>
  • Date: Wed, 29 Jul 2009 22:09:20 -0400

When using NSUserDefaults to get command line arguments, it doesn't seem to handle negative numbers correctly.
In main.m:
NSUserDefaults *args = [NSUserDefaults standardUserDefaults];

int x = [args integerForKey:@"x"];
int y = [args integerForKey:@"y"];
If the command line is "MyApp -x -100 -y 100", NSUserDefaults does not recognize the -100 as the value of the x argument - it sets x to 0. If the '-' is removed, everything is fine. Is this a bug? Is there a way around?
Thanks again!
Sean DeNigris
email@hidden




_______________________________________________

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: NSUserDefault and Negative numerical arguments (Was: Posting mouse clicks with multiple displays)
      • From: Bill Bumgarner <email@hidden>
  • Prev by Date: Binding collection view label through two entities
  • Next by Date: Re: where can I download xcode 3.2
  • Previous by thread: Re: [SOLVED] Binding collection view label through two entities
  • Next by thread: Re: NSUserDefault and Negative numerical arguments (Was: Posting mouse clicks with multiple displays)
  • Index(es):
    • Date
    • Thread