Apple が推奨する NSMetadataQuery を使用して、アプリの iCloud フォルダーにある txt ファイルの配列を取得しようとしています。
NSMetadataQuery *query = [[NSMetadataQuery alloc] init];
[query setSearchScopes:[NSArray arrayWithObject:NSMetadataQueryUbiquitousDocumentsScope]];
NSPredicate *pred = [NSPredicate predicateWithFormat:@"%K ENDSWITH '.txt'", NSMetadataItemFSNameKey];
[query setPredicate:pred];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryDidFinishGathering:) name:NSMetadataQueryDidFinishGatheringNotification object:query];
[query startQuery];
残念ながら、 queryDidFinishGathering: は呼び出されません。私は何を間違っていますか?
ありがとう!