NSnumber到NSstring

时间:2013-03-26 19:58:52

标签: nsstring nsnumber

Stock *stockObject;

stockObject = [[Stock alloc]initWithIssuingCompany:addCompany stockName:@"one" stockPrice:[NSNumber numberWithFloat:150.3]];       

[availableStocks addObject:stockObject];


float myfloat = [s.stockPrice floatValue];

NSLog(@" singleton @%f",myfloat);

试试这段代码,但它会粉碎:

float myfloat = [s.stockPrice floatValue];

没有错误。

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

不应该是[stockObject.stockPric floatValue]