【发布时间】:2015-09-18 22:33:02
【问题描述】:
我刚刚将 xcode 更新到 7.0,我现有的陀螺仪代码现在给了我一个错误。我已经玩了几个小时了,但我无法弄清楚。我该如何纠正这个问题?
override func viewDidLoad() {
if motionManager.gyroAvailable {
motionManager.startGyroUpdates()
motionManager.deviceMotionUpdateInterval = 0.2
motionManager.startDeviceMotionUpdates()
motionManager.gyroUpdateInterval = 0.2
motionManager.startGyroUpdatesToQueue(NSOperationQueue.currentQueue()!) {
[weak self] (gyroData: CMGyroData!, error: NSError!) in
self!.outputRotationData(gyroData.rotationRate)
if error != nil {
print("\(error)")
}
}
} else {
print("gyro not avail")
}
super.viewDidLoad()
}
错误 1: 无法将类型“(CMRotationRate,错误:NSError.Type)”的值转换为预期的参数类型“CMGyroHandler”(又名“(可选,可选)->()”)
【问题讨论】: