Closed alzin closed 3 years ago
Agent comment from Luce Luo in Zendesk ticket #41507:
Dear Customer,
Thank you for contacting DJI.
Sorry, but have you ensure you have set the delegate first?
The update callback will work after it.
Thanks,
Luce Luo
DJI Developer Support
inline-94991270.png
Thank you for your prompt answer and support!
I was actually setting the delegate but it was at the beginning of the program in the viewDidLoad function which returned nil for the Remote Controller in the following function
class ViewController: DJIRemoteControllerDelegate {
func fetchRemoteController() -> DJIRemoteController? {
if !(DJISDKManager.product() != nil){
return nil
}
if DJISDKManager.product() is DJIAircraft {
return (DJISDKManager.product() as! DJIAircraft).remoteController
}
return nil
}
and then after the timeline mission has started I call the previous function and get the delegate of the controller correctly
let rem = self.fetchRemoteController()
rem?.delegate = self
Agent comment from Luce Luo in Zendesk ticket #41507:
Dear Customer,
Thank you for contacting DJI. The code is right but not sure the root cause. Can you please fill in the below form with more detail? We will handle it soon after we received the detail. https://formcrafts.com/a/dji-developer-feedback-en
Thanks,
Luce Luo DJI Developer Support
I need help in triggering an action when a change in the sticks of the remote controller of the drone is held. Actually, I want to stop the timeline mission of the drone automatically when a user starts playing with the sticks.
I think I need to keep listening to the sticks values of the drone and I am trying to listen to (DJI Remote Controller did Update State) but I can't make it happened. I don't know maybe because I miss initializing something or I need to use a different method!?
Working Environment:
macOS Big Sur Xcode 12.2 Swift 5