對於iCloud的插件,我寫,我訂閱我的iCloud管理器類這些iCloud的NSMetaDataQuery觀察員:NSMetaDataQuery從來不打電話回來NSMetadataQueryDidFinishGatheringNotification
// Add a predicate for finding the documents
NSString* filePattern = [NSString stringWithFormat:@"*.%@", @"*"];
self.metadataQuery = [[NSMetadataQuery alloc] init];
// Before starting to query, it is required to set the search scope.
arrayWithObject:NSMetadataQueryUbiquitousDocumentsScope]];
// It is also required to set a search predicate.
[self.metadataQuery setPredicate:[NSPredicate predicateWithFormat:@"%K LIKE %@", NSMetadataItemFSNameKey, filePattern]];
// Listen for the second phase live-updating
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(queryDidReceiveNotification:) name:NSMetadataQueryDidUpdateNotification object:nil];
// Listen for the first phase gathering
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(queryIsDoneGathering:) name:NSMetadataQueryDidFinishGatheringNotification
object:nil];
[self.metadataQuery startQuery];
的問題是,沒有這些選擇實際上是不斷被召回,甚至沒有,我特別需要NSMetaDataQueryDidUpdateNotification來跟蹤雲中文件的上傳/下載進度。
有一件奇怪的事情是,我前些天有這樣的工作,但不知何故它剛剛停止工作,並且我試圖弄清楚問題實際上是什麼都不知情。通過下注到NSMetadataQueryDidStartGettingNotification我可以看到它確實啓動,但它就像它永遠不會結束。這很奇怪。
我想知道是否有人有任何線索,因爲上述代碼會出現什麼問題?或者我可以在哪裏找到問題。
感謝您的時間:)
你有沒有發現這有什麼問題?我很想回答。 – OlivaresF
不幸的是,我從來沒有發現這是什麼原因。我找不到任何其他地方在線任何解釋:(仍然會愛上一個答案 – CodingBeagle
你想要搜索的所有文件的列表嗎?你有沒有試過讓filepattern是一個單一的文件類型,如.txt? – OlivaresF