Swift 2 to Swift 3.0 motionManager

后端 未结 2 1422
渐次进展
渐次进展 2021-01-26 23:30

I am converting an app from swift 2 to swift 3 and I\'m trying to use the CMMotionManager, but it gives me this error when I try to call the .startAccelerometerUpdates() functio

2条回答
  •  后悔当初
    2021-01-26 23:57

    There are many changes in Swift3. Especially in expressions. Many NS suffix of types are removed such as NSError to Error, NSData to Data. Therefore, change NSError to Error. And if you want to prevent performance issue by multiple instances of CMMotionManager, use SwiftyMotionManager.

提交回复
热议问题