ios - Swift 2 to Swift 3.0 motionManager -
i converting app swift 2 swift 3 , i'm trying use cmmotionmanager, gives me error when try call .startaccelerometerupdates() function... no clue what's wrong though.
this how initialize manager:
let motionmanager = cmmotionmanager()
trying call function:
motionmanager.startaccelerometerupdates(to: operationqueue.main) { [weak self] (data: cmaccelerometerdata?, error: nserror?) in self!.outputaccelerationdata(data!.acceleration) }
error: cannot convert value of type '(cmaccelerometerdata?, nserror?) -> ()' expected argument type 'cmaccelerometerhandler' (aka '(optional, optional) -> ()')
thanks!
the cryptic error message boils down this: in swift 3 nserror
bridged error
instead. write code , problem should go away:
motionmanager.startaccelerometerupdates(to: operationqueue.main) { [weak self] (data: cmaccelerometerdata?, error: error?) in
Comments
Post a Comment