1

In my app I only show assets the user can edit, so I only show photos - no videos. New in iOS 11 Live Photos have two effects that effectively turn the photo into a video - Loop and Bounce. These Live Photos cannot be edited in the Photos app - the plugins button is disabled. I need to filter those out in my PHFetchResult. But mediaType of image still includes these 'live videos'. How can I exclude those from the fetch? Maybe something to do with the playbackStyle of PHAsset?

let photoLibraryFetchResult = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumUserLibrary, options: nil)  
let assetCollection = photoLibraryFetchResult.firstObject!  

let imagesOnlyFetchOptions = PHFetchOptions()  
imagesOnlyFetchOptions.predicate = NSPredicate(format: "mediaType = %d", PHAssetMediaType.image.rawValue)  

let assetsFetchResults = PHAsset.fetchAssets(in: assetCollection, options: imagesOnlyFetchOptions)
4

1 回答 1

2

尝试查看playbackStyle价值。(在这里阅读更多

枚举具有以下选项:

case image
case imageAnimated
case livePhoto
case unsupported
case video
case videoLooping
于 2017-06-23T03:50:06.993 回答