How do I determine if a PHAsset in a PHFetchResult represents a deleted photo?

前端 未结 3 1128
长情又很酷
长情又很酷 2020-12-29 11:14

I\'m trying to grab a thumbnail of the last photo taken on a device using the new Photos framework in iOS 8. The code I have right now to do this is the following:



        
3条回答
  •  半阙折子戏
    2020-12-29 12:04

    There is no property indicating if the phasset is deleted or not
    the only way it worked for me is to check again with the PHAssetLocalID

    if PHAsset.fetchAssets(withLocalIdentifiers: [pHAsset.localIdentifier], options: .none).count == 0 { }

提交回复
热议问题