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

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -