<分区>
所以我有一个 NSArrays 加载了用于保存在 Shot
上的俯仰和偏航值对象。
@interface Shot : NSObject
@property (strong, nonatomic) NSArray *pitch;
@property (strong, nonatomic) NSArray *yaw;
我正在尝试快速进行一些数字运算,但遇到了一个非常奇怪的问题:
let pitch = Array(shot.recoil_pitch[0..<10]) as! [Float]
let yaw = Array(shot.recoil_yaw[0..<10]) as! [Float]
由于某种我无法弄清楚的原因,第一行运行正常。然而,第二行抛出 Fatal error: Unable to bridge NSNumber to Float
。 .
当我检查 shot.recoil_pitch[0..<10]
在调试器中我得到:
- 0 : 0
- 1 : -0.1355667114257812
- 2 : -2.584976196289062
- 3 : -2.238974571228027
- 4 : -1.606719017028809
- 5 : -1.54025936126709
- 6 : -1.570234298706055
- 7 : -1.544057846069336
- 8 : -1.323789596557617
- 9 : -1.073002815246582
当我检查 shot.recoil_yaw[0..<10]
我得到:
- 0 : 0
- 1 : 0.017406463623046875
- 2 : -0.07871246337890625
- 3 : 0.004611968994140625
- 4 : 0.0446014404296875
- 5 : -0.0008544921875
- 6 : 0.010448455810546875
- 7 : 0.01015472412109375
- 8 : -0.002346038818359375
- 9 : -0.0569610595703125
关于为什么我可能会收到此错误的任何想法?