I have string and I want to convert into double value. I have written code but sometimes my program is being crashed.
double left_operand=[operand_1 doubleValue];
Here operand_1
is NSString v开发者_运维知识库ariable and i want to convert it into double value. Sometimes above code is crashing my program (automatically closed simulator)
Is above code right?
You may be getting this error because operand_1 is not accessible here because probably you are releasing it above this line or if you are using auto release then you are not retaining it, check for it by NSLog(@"%@",operand_1);
before the above line if you are getting same error then i m right.
float valueFloat=[*your string* floatValue];
double valueDouble=[*yourstring* doubleValue];
精彩评论