Does Someone know why in my xCode there isn't function startAccelerometerUpdateQueue? Here there is a screenshot of my xCode: Screen1
I thought maybe the function was deprecated, so I selected the function starAccelerometerUpdate. But when i try to insert the NSOperationQueue.mainQueue(), xCode doesn't see that too (it suggests to change NSOperationQueue in OperationQueue, but i need the function mainQueue(). Screen2
You're reading old documentation or an old tutorial. The method was renamed in Swift 3's "Grand Renaming". The second version you tried is close, (startAccelerometerUpdate(to: handler:)
) but NSOperationQueue
is now OperationQueue
. It should look like this:
motionManager.startGyroUpdates(to: OperationQueue.main) { (data, error) in
// Your handler code here
}