Re: Warning about comparison between pointer and integer

2009-12-16 Thread jonat...@mugginsoft.com
> > Should I use a temporary variable to check instead of the variable with the > pointer? Or are these warnings okay to ignore? With regard to warnings I would recommend the following: http://boredzo.org/blog/archives/2009-11-07/warnings http://developer.apple.com/tools/xcode/compilercodewarnin

Re: Warning about comparison between pointer and integer

2009-12-16 Thread Fritz Anderson
On 16 Dec 2009, at 10:18 AM, Eric E. Dolecki wrote: > I am using NSUserDefaults to store some data. On first run of the > application, I check for the data, and if it's not been set already, I set > it. This is done, and better, by -[NSUserDefaults registerDefaults:]. > I however get warnings in

Re: Warning about comparison between pointer and integer

2009-12-16 Thread Eric E. Dolecki
Ah okay - thanks. I am now doing this: if( [prefs objectForKey:@"alarm1Hour"] == nil ){ ... On Wed, Dec 16, 2009 at 11:33 AM, Scott Ribe wrote: > > integerForKey > > Returns an integer, not a pointer. See the docs. > > If you want to check if the key exists, then objectForKey will return ni

Re: Warning about comparison between pointer and integer

2009-12-16 Thread Scott Ribe
> integerForKey Returns an integer, not a pointer. See the docs. If you want to check if the key exists, then objectForKey will return nil of the key is not found. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___

Re: Warning about comparison between pointer and integer

2009-12-16 Thread Dave Carrigan
On Dec 16, 2009, at 8:18 AM, Eric E. Dolecki wrote: > NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; > > alarm1_hour = [prefs integerForKey:@"alarm1Hour"]; > > if( alarm1_hour == NULL ){ > > NSLog(@"alarm 1 hour is null" ); > > } -integerForKey returns a NSInteger. Comparing

Warning about comparison between pointer and integer

2009-12-16 Thread Eric E. Dolecki
I am using NSUserDefaults to store some data. On first run of the application, I check for the data, and if it's not been set already, I set it. I however get warnings in my code. In my .h I set up my variables, and then in my .m: NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; al