我在大疆github (安卓或ios)中尝试了几乎所有的示例,但无法将我的dji产品(幻影4 pro+ V2.0)连接到我的应用程序。我可以使用我的api密钥成功注册我的应用程序,但是当我用USB线将dji产品连接到手机上时,我看不到任何连接。请帮我一下。
发布于 2019-08-08 22:37:37
用于iOS应用程序密钥的UISupportedExternalAccessoryProtocols:您需要将外部密钥添加到您的plist文件中。像这样`
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>com.dji.video</string>
<string>com.dji.protocol</string>
<string>com.dji.common</string>
</array>
然后使用DJIAssistantSimulator来模拟无人机的位置。
发布于 2021-01-14 12:00:34
将drone连接到应用程序的第一步是调用DJISDKManager.registerApp
并传递DJISDKManagerDelegate
的一个实例。
class ProductPublisher : NSObject, ObservableObject {
...
func registerWithSDK() {
...
DJISDKManager.registerApp(with: self)
}
...
}
重要的部分是您的委托实现了一些必需的方法和调用DJISDKManager.startConnectionToProduct()
。
extension ProductPublisher : DJISDKManagerDelegate {
func appRegisteredWithError(_ error: Error?) {
// set breakpoint here
DJISDKManager.startConnectionToProduct()
}
func productConnected(_ product: DJIBaseProduct?) {
// set breakpoint here, this marks a successful connection
}
}
ProductPublisher
类是我自己的一个类,我在其中封装了所有关于注册和连接的逻辑。它是我正在编写的iOS的tutorial series的一部分。我刚才解释的内容在第2部分。
https://stackoverflow.com/questions/57055952
复制相似问题