MHaroonBaig / MotionKit

Get the data from Accelerometer, Gyroscope and Magnetometer in only Two or a few lines of code. CoreMotion now made insanely simple :octocat: :satellite:
http://goo.gl/bpXBlO
MIT License
1.08k stars 135 forks source link

Delegate functions are not getting called #16

Closed qadirsuh closed 3 years ago

qadirsuh commented 8 years ago

I have done like below in my ViewController

`import UIKit
 import AVFoundation
 import CoreMotion

class ViewController: UIViewController, MotionKitDelegate  {

override func viewDidLoad() {
    super.viewDidLoad()

    let motionKit = MotionKit()
    motionKit.delegate = self
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func retrieveAccelerometerValues (x: Double, y:Double, z:Double, absoluteValue: Double){

}

func retrieveGyroscopeValues     (x: Double, y:Double, z:Double, absoluteValue: Double){

}

@objc func retrieveDeviceMotionObject  (deviceMotion: CMDeviceMotion){

}

func retrieveMagnetometerValues  (x: Double, y:Double, z:Double, absoluteValue: Double){

    print("x \(x), y \(y), z \(z), absoluteValue \(absoluteValue)")

}

func getAccelerationValFromDeviceMotion        (x: Double, y:Double, z:Double){

}
func getGravityAccelerationValFromDeviceMotion (x: Double, y:Double, z:Double){

}

func getRotationRateFromDeviceMotion           (x: Double, y:Double, z:Double){

    print("x \(x), y \(y), z(z)")

}
func getMagneticFieldFromDeviceMotion          (x: Double, y:Double, z:Double){

    print("x \(x), y \(y), z(z)")

}

@objc func getAttitudeFromDeviceMotion               (attitude: CMAttitude){

}

}

` I just see the only Log is MotionKit has been initialised successfully

as you have done in the init() like below

 `   init(){
     NSLog("MotionKit has been initialised successfully")
   }   `

I have changed like this

`    init(){
    manager.showsDeviceMovementDisplay = true
    NSLog("MotionKit has been initialised successfully")
     }`

still no any functions are called. What I am missing?