我想过滤掉所有在 iOS8 中没有本地化标题的时刻。为此,我使用了 Photo 框架和本地化标题键。但是,这个键似乎根本不能作为 fetchMomentsWithOptions 中的一个选项。确实,如果我尝试以下操作:
var collectionOptions = PHFetchOptions()
collectionOptions.predicate = NSPredicate(format: "!(SELF.localizedTitle = nil)")
collectionOptions.sortDescriptors = [NSSortDescriptor(key: "endDate", ascending: false)]
self.fetchResult = PHAssetCollection.fetchMomentsWithOptions(collectionOptions) as PHFetchResult
它不返回任何事件,如果我这样做
var collectionOptions = PHFetchOptions()
collectionOptions.predicate = NSPredicate(format: "SELF.localizedTitle = nil")
collectionOptions.sortDescriptors = [NSSortDescriptor(key: "endDate", ascending: false)]
self.fetchResult = PHAssetCollection.fetchMomentsWithOptions(collectionOptions) as PHFetchResult
此获取结果返回照片库中的所有时刻。正如任何人遇到同样的问题