Constant is not finite! That's illegal. constant:nan

来源:互联网 发布:简易画地图软件 编辑:程序博客网 时间:2024/05/16 13:54

近日,在开发的过程中在友盟统计上看到了我们的app出现了Constant is not finite! That's illegal. constant:nan的崩溃,定位之后只看到了这样的代码:

CGFloat percent =ceil(self.model.num1.floatValue / self.model.num2.floatValue)

self.percentViewWidthConstrait.constant = percent;

造成这个问题的原因就是这个除法的问题:我所发现的有两种可能(1)就是你的除数为0(2)除数或者被除数为null  这两种情况在你做除法的时候可能不会出现错误,但是当你设置constant的时候就会出现问题。


0 0