从图库中获取没有iCloud资产的视频

时间:2018-07-25 14:23:46

标签: video fetch assets icloud

让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)

0 个答案:

没有答案