ios - 从 DJI 无人机检索带有 EXIF 数据的图像

标签 ios swift dji-sdk

我在iOS中使用DJISDK从飞机上下载图片。

我正在使用 PlaybackManager 类中的 downloadSelectedFiles 方法。

这是我的流程回调:

process: { (data, error) in
    if data != nil{
        if self.downloadedImageData != nil{
            self.downloadedImageData!.append(data!)
        }else{
            self.downloadedImageData = data!
        }

    }
}

这是文件完成回调:

fileCompletion: {
    self.downloadedFilesCount += 1
    let image = UIImage(data: self.downloadedImageData!)
    if let img = image {
        self.downloadedImagesArray?.append(img)
    }
    self.downloadedImageData = nil         
}

我正确检索了图像,但没有 EXIF 数据。我如何获取该信息并将其添加到图像中? 我已经下载并尝试了 iOS-MediaManagerDemo,它是同样的事情,下载图像但没有 exif 数据,但官方 DJI Go 应用程序检索所有信息,因此必须有某种方法来做到这一点。

最佳答案

还有一个similar issue in their forums关于空元数据和 downloadSelectedFilesWithPreparation 。创建帖子的用户 也找到了解决办法:

I solved the problem by not converting the NSData into any format instead saved the NSData directly. Using PHAssets and temporary file to store the NSData as PHAssets only accepts data from URL.


尝试使用fetchFileDataWithOffset:updateQueue:updateBlock (在 Swift 中它将被称为 fetchFileData(with:updateQueue:updateBlock))

[...] fetching the media data will return all data for a video or image


示例代码(objc):here

关于ios - 从 DJI 无人机检索带有 EXIF 数据的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45872030/

相关文章:

ios - 在 Swift 中,不能子类泛型 : class Foo<T> : T {}

ios - 嵌套多个 CollectionView

android - 是不是所有安卓设备都兼容dji SDK mobile?

ios - UITextField - textFieldDidEndEditing 调用太迟

ios - 导出 ipa 文件失败

ios - 将十六进制代码转换为日期 (BLE) - 算法

dji-sdk - 从服务器收到的元数据无效,请重新连接服务器并尝试

gps - DJI Phantom 3 Advance使用什么地理引用系统和基准

ios - 长宽比限制没有改变

ios - Twitter API 允许我通过状态发布推文,但如果我想添加图像则不能上传媒体