• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
addobserver forkeypath breaks NSMetadataQuery live updates?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

addobserver forkeypath breaks NSMetadataQuery live updates?


  • Subject: addobserver forkeypath breaks NSMetadataQuery live updates?
  • From: Derrek Leute <email@hidden>
  • Date: Sat, 9 Jul 2005 09:19:04 -0400


This may be a duplicate message as my satellite connection failed when sending. Here it is again:


The subject line says it all. If I add an observer like this:

[self addObserver:self forKeyPath:@"groupQuery.results" options:NSKeyValueObservingOptionNew context:nil];

NSMetadataQuery stops "working" after a single live update happens. I am using observeValueForKeyPath to perform some logic on items as the change dictionary provides them. Also, it calls observeValueForKeyPath twice providing the first results both times in the change dictionary. It then updates once if I change a file and no longer after that. If I use a notification center and remove addObserver it works fine but I don't get live updates. I wait for a didFinish gathering notification, disableUpdates, cycle through the query as necessary and then enableUpdates.

Is there a way to get live-updates that doesn't break NSMetadataQuery? Would manual bindings work better in this situation?

An additional complication is I'd like to use coredata to store kMDItemPath values from the query results so when my application restarts the user doesn't have to wait for "fresh" results from several spotlight searches to use the interface. To do this I need to add new results during the gathering phase and remove stale results after the search finishes. Then intersect results for any live- updates that happen. This logic appeared to be working with observeValueForKeyPath except that addObserver breaks live updates.

I suspect it breaks live updates because whatever gets the change dictionary doesn't know to send disableUpdates to a query before getting results. Is there something I can override that would make addObserver send disableUpdates and then enableUpdates when it gets the changes?

I hope that was clear.

Thanks!

--Derrek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Documentation frustrations
  • Next by Date: Re: mutableArrayValueForKeyPath gives me valueForUndefinedKey
  • Previous by thread: addobserver forkeypath breaks NSMetadataQuery live updates?
  • Next by thread: Getting all managed objects of given entity
  • Index(es):
    • Date
    • Thread