objective c - Add a (double) variable to NSMutableArray -
i have user input variable , want add array. firststore bool type t determine if array has been initialize. first time store called, initialize array. tried make num equal operand (which double) masking nsnumber doesn't seem work because have error "nsnumber may not respond +operand", program crashes when hits line [memarray addobject:num]. i'm new @ stuff appreciated.
else if ([operation isequal:@"store"]) { if(!firststore){ memarray = [[nsmutablearray alloc] init]; nsnumber *num = [nsnumber operand]; [memarray addobject:num]; firststore = yes; } else { //nsnumber *num = [nsnumber operand]; //[memarray addobject:num]; } }
try changing [nsnumber operand]
[nsnumber numberwithdouble:operand]
.
Comments
Post a Comment