I want to get the update of the Compass of my P4 RTK with my Mobile SDK for iOS, but I am not getting any output in the terminal.
I am using SwiftUI on Xcode.
This is the code I am using.
if let locationKey = DJIFlightControllerKey(param: DJIFlightControllerParamCompassHeading) {
DJISDKManager.keyManager()?.startListeningForChanges(on: locationKey, withListener: self, andUpdate: { (oldValue: DJIKeyedValue?, newValue: DJIKeyedValue?) in
if (newValue != nil) {
print("Compass: \(newValue!.doubleValue)")
}
})
}
If I unterstand the code startListeningForChanges right, I should get an print output, when I rotate the drone?