NSDecimalNumbers的运行时错误? [英] runtime error with NSDecimalNumbers?
问题描述
当这行代码运行时我收到错误,我不熟悉NSDecimalNumber所以我不确定这行有什么问题,Xcode在我实际运行代码之前没有给我任何错误。
I am getting an error when this line of code runs, I am unfamiliar with NSDecimalNumber so Im not really sure what is wrong with this line and Xcode is not giving me any error until I actually run the code.
if ([unit1 isEqualToString: [_Distance objectAtIndex:0]])
universalAns = [num1 decimalNumberByMultiplyingBy: (NSDecimalNumber*)[NSDecimalNumber numberWithDouble:0.0254]];
这里是调试器输出到目前为止:
self(ViewController *)0x8c8cd10
unit1 =(__ NSCFConstantString *)@inches
universalAns NSDecimalNumber * nil
num1(__ NSCFNumber *)(双)0
_Distance(__ NSArrayI *)@8个对象
任何想法都会有所帮助,
提前致谢!
here is the debugger output up to this point:
self (ViewController *) 0x8c8cd10
unit1 = (__NSCFConstantString *) @"inches"
universalAns NSDecimalNumber * nil
num1 (__NSCFNumber *) (double)0
_Distance (__NSArrayI *) @"8 objects"
Any ideas would be helpful,
Thanks in advance!
推荐答案
我解决了,由于某种原因,num1不是NSDecimalNumber。
I solved it, num1 was not a NSDecimalNumber for some reason.
这篇关于NSDecimalNumbers的运行时错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!