nsmetadataquery

Why is NSMetadataQueryDidUpdateNotification being called several times in quick succession?

耗尽温柔 提交于 2019-12-19 10:05:31
问题 In order to monitor file changes in my iCloud container, I've registered for [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(processiCloudUpdates:) name:NSMetadataQueryDidUpdateNotification object:nil]; Ideally, whenever I receive the message that updates have been made, I'd like to open each of my UIDocs and check if settings have been changed. This would be fine, if NSMetadataQueryDidUpdateNotification was only called once. However, it is being fired several times

cannot call NSMetadataQueryDidUpdateNotification

喜你入骨 提交于 2019-12-13 02:27:21
问题 I want to track percentage of my uploaded file to icloud using NSMetadataQuery , but It didn't work. This is my code : dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) { NSFileCoordinator* fileCoordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil]; [fileCoordinator coordinateReadingItemAtURL:backupUrl options:NSFileCoordinatorReadingWithoutChanges error:nil byAccessor:^(NSURL *newURL) { NSFileManager* fm = [NSFileManager defaultManager];

NSPredicate(s) for NSMetadataQuery to match kMDItemAccessedDates (array) containing a target date?

大城市里の小女人 提交于 2019-12-11 18:47:35
问题 UPDATE: I found an answer though there may still be a better way - see the answer added below. a spotlight importer imports metadata that is an array of dates in which an item was accessed. Looks like this: kMDItemAccessedDates = ( "2012-06-18 07:00:00 +0000", "2013-01-10 08:00:00 +0000", "2013-01-15 08:00:00 +0000" ) I'd like to query for any of these files that were accessed on a particular date the user enters but I'm not finding the right syntax to do this. Wondering if it's possible to

Setting up NSMetadataQueryDidUpdateNotification for a simple response

為{幸葍}努か 提交于 2019-12-11 13:59:39
问题 I'm trying to get up and running with an NSMetadataQueryDidUpdateNotification on an OS X app, to alert me when a file in my iCloud ubiquity container is updated. I've been doing a lot of research (including reading other Stack answers like this, this, this, and this), but I still don't have it quite right, it seems. I've got a "CloudDocument" object subclassed from NSDocument, which includes this code in the H: @property (nonatomic, strong) NSMetadataQuery *alertQuery; and this is the M file:

iCloud Error “The operation couldn't be completed. (LibrarianErrorDoman error 10 - Unable to configure the collection.)”

南笙酒味 提交于 2019-12-11 12:59:27
问题 i want to migrate my existing app to iCloud. in my attempt to learn what to do, i have tried a sample app that has worked as described in the demo (as seen in lecture 17 of the iTunes stanford university course). can someone who has had this problem help me diagnose what step i messed up to cause the following to fail? is this just telling me basically that there's no data to query? or is there something else going on that i haven't properly configured? i am getting the following in my

iCloud: Getting an array of txt files present in the cloud on OS X

我的未来我决定 提交于 2019-12-11 08:26:52
问题 I am trying to get an array of txt files in my app's iCloud folder using a NSMetadataQuery as recommended by Apple: 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

iCloud Drive list directories and files through NSMetadataQuery

回眸只為那壹抹淺笑 提交于 2019-12-10 18:27:57
问题 I have built an iCloud-enabled app named "rmc".My app now can upload files to iCloud Drive and get metadata by NSMetadataQuery.But NSMetadataQuery's results only include the files in my APP's Container.Please see this link:https://developer.apple.com/videos/wwdc/2015/?id=234, this is a document and it is said that NSMetadataQuery can get files in other APP's container.What I want is that I can get all files in iCloud Drive,just like the app "Document 5" and "Cloud Lite",they can get all files

NSMetadataQuery doesn't finish gathering (no notification)

泪湿孤枕 提交于 2019-12-10 06:36:25
问题 I'm making a backup managrer for my App (via iCloud). I did some tests and the basics worked. But few days later it stopped. I'm using NSMetadataQuery for searching if backup file exists. My backup files are named e.g. Backup29112011154133.xml where numbers represent date of the backup (formatted as ddMMyyyyHHmmss ). I check for it in -viewDidAppear : - (void)viewDidAppear:(BOOL)animated { [self checkForRemoteFile]; } - (void)checkForRemoteFile { NSURL *ubiq = [[NSFileManager defaultManager]

How can I sort an icloud NSMetadataQuery result of UIDocument's by modification date?

南笙酒味 提交于 2019-12-07 00:36:09
问题 I have an iOS application that uses a simple UIDocument model with a single content field for iCloud storage. I retrieve the list of documents to populate a UITableView using an NSMetadataQuery. I want to have new documents appear at the top of this table, but the default sorting appears to be old -> new. I know if I had a custom date field in the document I could sort the query with the NSSortDescriptor on that field but my question is is it possible to sort by the intrinsic modification

NSMetadataQuery doesn't finish gathering (no notification)

房东的猫 提交于 2019-12-05 09:27:28
I'm making a backup managrer for my App (via iCloud). I did some tests and the basics worked. But few days later it stopped. I'm using NSMetadataQuery for searching if backup file exists. My backup files are named e.g. Backup29112011154133.xml where numbers represent date of the backup (formatted as ddMMyyyyHHmmss ). I check for it in -viewDidAppear : - (void)viewDidAppear:(BOOL)animated { [self checkForRemoteFile]; } - (void)checkForRemoteFile { NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]; if (ubiq) { NSMetadataQuery *query = [[NSMetadataQuery alloc]