I have an issue with the iCloud metadataQuery.
I am trying to fetch some documents from iCloud but when I call the NSPredicate function I get the following error in the console of Xcode:
warning: could not load any Objective-C class information from the dyld shared cache. This will significantly reduce the quality of type information available.
Note: I am using Swift version 2.
This is my function:
var _iCloudQuery:NSMetadataQuery!
func iCloudQuery()->NSMetadataQuery?{
if (_iCloudQuery == nil) {
_iCloudQuery = NSMetadataQuery.init()
_iCloudQuery.searchScopes = [NSMetadataQueryUbiquitousDocumentsScope]
_iCloudQuery.predicate = NSPredicate(format: "(%K = '*')", NSMetadataItemURLKey)//
// Set observer here
NSNotificationCenter.defaultCenter().addObserver(self, selector: "processCloudQueryResults:", name: NSMetadataQueryDidFinishGatheringNotification, object: _iCloudQuery)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "processCloudQueryResults:", name: NSMetadataQueryDidUpdateNotification, object: _iCloudQuery)
}
return _iCloudQuery
}
I already figured out that processCloudQueryResults
never gets fired because there are no items in icloudQuery
but still there are documents in my iCloud container so there should.
This is a related topic with no solutions:
Searching for files using NSMetadataQuery does simply nothing