照片框架

Photos framework

这是我的代码:

PHImageManager.default().requestImageData(for: asset!, options: PHImageRequestOptions(), resultHandler: {
    (imagedata, dataUTI, orientation, info) in

     if PHImageResultIsInCloudKey == "true" {
          print("Works!") // not executed
}
}

我不知道如何正确使用 PHImageResultIsInCloudKey 来检查 returns 是对还是错。

我应该怎么做?

我还没有编译代码,但这应该可以工作:

PHImageManager.default().requestImageData(for: asset!, options: PHImageRequestOptions(), resultHandler: {
(imagedata, dataUTI, orientation, info) in

 if let info = info as [String: Any], let isIniCloud = info[PHImageResultIsInCloudKey] as NSNumber, isIniCloud.boolValue == true {
      print("Works!") // not executed
 }
}