objective C - 从服务器下载图像到 iPhone 并保留日期

objective C - download image from server to iPhone and retain the date

我们处理了很多照片 - 有些是从 iPhone 拍摄的,有些是从我们的 DSLR 相机拍摄的。他们都被上传到我们的服务器。

我们的应用程序允许将媒体文件(照片和视频)从我们的服务器下载到 iPhone(所有照片文件夹,而不是应用程序沙箱)。保存此下载的图像时,图像创建的 date/time 在下载并保存在 iPhone 上时变为 date/time,而不是图像最初 [=] 时的 date/time 23=] 来自数码单反相机。

如何设置文件的日期与服务器上的日期一致

这之所以重要,是因为这将允许 iPhone 照片应用程序显示图像以及同时拍摄的其他图像。

您可以使用更改请求属性更新照片资产元数据日期和位置。

[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
    PHAssetChangeRequest *changeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:<#your photo here#>];
    changeRequest.creationDate  = serverDate
} completionHandler:^(BOOL success, NSError *error) {
    if (success) {

    }
}];