iCloud NSMetadata query results are blank

僤鯓⒐⒋嵵緔 提交于 2019-12-04 19:02:02

Since you already set the search scope correct, there's no need to use special filters in the predicate. Just use:

query.predicate = [NSPredicate predicateWithFormat:@"NSMetadataItemFSNameKey == '*'"];

And to get the array use:

NSMutableArray *array = [NSMutableArray array];
for (NSMetadataItem *item in query.results) {
        [array addObject:[item valueForAttribute:NSMetadataItemFSNameKey]];
}
Sam Spencer

I've solved my problem. Getting the list of files in iCloud was just a matter of correctly defining, allocating, and initializing properties. SAE's answer and this SO posting helped me solve my problem and create this GitHub Repo called iCloud Document Sync. The iCloud Document Sync class simplifies the whole iCloud Document storage process down to a few lines of code. The commit linked here fixes the issues from my question.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!