让allPhotosOptions:PHFetchOptions = PHFetchOptions.init() allPhotosOptions.sortDescriptors = [NSSortDescriptor(key:“ creationDate”,升序:true)]
// allPhotosOptions.predicate = NSPredicate(format: "mediaType = %d", PHAssetSourceType.typeUserLibrary.rawValue)
let allPhotosResult = PHAsset.fetchAssets(with: .video, options: allPhotosOptions)
allPhotosResult.enumerateObjects({ (asset, idx, stop) in
print(asset)
let dict = NSMutableDictionary()
dict.setObject(asset, forKey: "asset" as NSCopying)
dict.setObject("n" , forKey: "isSelected" as NSCopying)
self.arrayPhoto.add(dict)