قالب وردپرس درنا توس
Home / IOS Development / IOS – SDK DJI Download image in quick

IOS – SDK DJI Download image in quick



I simply try to download the latest access to the feed from the DJI drone and convert the feed to a UIImage. The easiest way I thought this could be done is to take a picture, and then immediately download the latest image from the storage. I want to add the download from the storage code below. Is this the easiest way? I received this error code –

  Parameter parameter settings failed. (Code: -1007)

I've researched, but couldn't find what this meant – the DJI documents are limited to just about everything obj-c. Here the code –

  @IBAction func download (_ sender: UIButton) {
la camera = self.fetchCamera ()

// Switch camera mode to allow media downloads
camera? .setMode (DJICameraMode.mediaDownload, withCompletion: {(error) i
if wrong! = zero {
self.status.text = "(wrong! .localizedDescription)"
}
otherwise {

// get media manager from drone to access the files
leave manager = camera! .mediaManager!

if wrong! = zero {
self.status.text = "State: (manager.sdCardFileListState.rawValue)"
self.status.text = "Incorrect update list: (wrong)"

}
otherwise {
print ("renewed file list")
print ("State: Manager.sdCardFileListState.rawValue)")


guard la files = manager.sdCardFileListSnapshot () otherwise {
self.status.text = ("No files to download")
return
}

self.status.text = "There are files to download"

were photos: [UIImage] = []

for file in files {

if file.mediaType == .JPEG {

self.status.text = ("Time created: (file.timeCreated)")

DispatchQueue.main.asyncAfter (deadline: .now () + 1
) { file.fetchData (withOffset: 0, update: DispatchQueue.main, update: {(_ data: Data?, _ isComplete: Bool, _ error: Error?) -> invalid if wrong! = zero { self.status.text = "State: (manager.sdCardFileListState.rawValue)" self.status.text = "Error downloading image: (wrong!)" } otherwise { // Unzip downloaded data and create image if let data = data, let downloadImage = UIImage (data: data) { self.status.text = "The image was downloaded!" images.append (downloadedImage) } } }) // end of filed data retrieval } } } // loop } } }) // end of camera setMode block } `

Any help will be appreciated – Thank you


Source link