I have simplifed some methods for ease of understanding and correction of the error. I get a ‘nan’ instead of getting the number and don’t understand why. I want to put the getNumber method inside the return statement. When I have the method inside it returns a string of nan but when I just put the 26 inside it returns 26, what I want.
-(double) getNumber { return 26; }
-(NSString *) convertToString {
return [NSMutableString stringWithFormat: @"%Lf",[self getNumber]];
// returns 'nan' when I replace [self getNumber] with 15 I get 15
}
You might want to use “%f” instead of “%Lf”, since you are passing a
double, not along double