我在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/