There shouldn't be anything different occurring if the code is loaded via bundle instead of compiled into the app.
There shouldn't be anything different occurring if the code is loaded via bundle instead of compiled into the app. When you load a Cocoa bundle the classes in the bundle are loaded into the app's address space and essentially become part of the app. Bundle code is not run in a separate thread or run loop unless you specifically make it so.
I don't believe this is a run loop or threading issue. What makes you think it is? Are you sure the object in your bundle that begins the query has not been deallocated by the time the results return?
What is holding on to it?
The search object is not retained by me, because it doesn't need to be. I've run the code with and without the retained search object in both the app and the plug-in and the result is always the same: the search makes it to the finish when run in the app, but not when run in the plug-in. As for the run loop: the problem is not that the plug-in is run in a separate loop, the problem is that the plug-in code doesn't have a run loop at all.
Why do I think so? Because James Bucanek (see the link in my question) and others say so and I have no reason to doubt them. – Elise van Looij Jun 7 at 12:54 I'll rephrase the run loop bit: as far as I can make out, the plug-in code is run by the app's run loop but it's not kept around long enough for the plug-in to receive notifications other than the very first one, the start notification, which is posted right away.
– Elise van Looij Jun 7 at 13:03 When you say "it's not kept around long enough", what are you referring to? Your plug-in must have a class that you instantiate somewhere. That instance must hang around long enough for it to receive the notification.
How are you loading the code in your plug-in? Is the instance of the plug-in's object retained? If not, it's probably just being autoreleased and deallocated, so of course it can't respond to the notification.
Plug-ins aren't magic, they just add classes to your app. – Rob Keniger Jun 8 at 5:52 I appreciate the fact that you are taking the trouble to answer my question, but I feel this is degrading into a kind of verbal ping-pong. I use plug-ins extensively, they manage views and persistent stores, react to and send notifications and more.
But apparently there is something about an asynchronous process that doesn't jell well with the plug-in architecture and I'm hoping to learn what that is. – Elise van Looij Jun 8 at 8:31 I'm not trying to be argumentative, all I'm asking is are you sure that the problem is due to the fact that the code is loaded from a plugin? Could there not be another reason?
– Rob Keniger Jun 9 at 0:50.
Replace: NSMetadataQuery *mdQuery = NSMetadataQuery alloc init; // ... mdQuery startQuery; with: dispatch_async(dispatch_get_main_queue(), ^{ NSMetadataQuery *mdQuery = NSMetadataQuery alloc init; // ... mdQuery startQuery; }); (If you need to target Leopard or earlier, use -performSelectorOnMainThread:withObject:waitUntilDone: instead. ).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.