我可以使用PHFetchResult *results = [PHCollectionList fetchTopLevelUserCollectionsWithOptions:nil];
我想必须有一种类似的方式来获取共享照片流专辑(或者我认为它们现在可能被称为“iCloud照片共享专辑”),但对于我的生活......无法弄明白。有人解决了这个问题吗?
答案 0 :(得分:4)
PhotoKit的查询逻辑让我感到困惑,但下面的答案对我有用(提示:你必须查询PHAssetCollection
,而不是PHCollectionList
)
PHFetchResult *results = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumCloudShared options:nil]
答案 1 :(得分:2)
对于那些寻找快速语法的人:
let result:PHFetchResult = PHAssetCollection.fetchAssetCollectionsWithType(PHAssetCollectionType.Album, subtype: PHAssetCollectionSubtype.AlbumCloudShared, options: nil)
result.enumerateObjectsUsingBlock({ (object: AnyObject!, index:Int, shouldStop:UnsafeMutablePointer<ObjCBool>) -> Void in
println("collection name: \(object.localizedTitle)")
})