I have a array which I fill with values from checkboxes, sliders and an NSTextField.
See below 001. And it´s working obviously.
However, when analyzing my code I get this message:
/Users/ronny/DEV/0200-ObjC4/Egg&Breakfast/Classes/TimeController.m:358:24:
Argument to 'NSArray' method 'arrayWithObjects:'
should be an Objective-C pointer type, not 'NSInteger'
I tried several things like type casting the three lines with intValue to (NSInteger). Without success. Any idea what´s wrong?
NSArray *myValues = [NSArray arrayWithObjects:
[isAppointment state], //Checkbox
[boxForEver state], //Checkbox
[boxMakeSound state], //Checkbox
[tickTackFlag state], //Checkbox
[txtRemark stringValue], //NSTextField
[slideHour intValue], //Slider
[slideMin intValue], //Slider
[slideSec intValue], //Slider
[startAuto state], //Checkbox
nil];
All of the lines that call
stateorintValueare incorrect.An
NSArraycan only hold references to Objective-C objects. ButstateandintValuereturnNSInteger, which is a typedef (alias) forlong, which is C primitive, not an Objective-C object reference.You need to wrap the integers in
NSNumberobjects. If you’re using Xcode 4.4 or later, you can just use the new@(...)wrapper syntax to wrap your integers inNSNumberobjects. You can also use the new array literal syntax@[...]to construct your array.