Re: Leopard problem: can't pass NSPredicate in a distributed object message
Re: Leopard problem: can't pass NSPredicate in a distributed object message
- Subject: Re: Leopard problem: can't pass NSPredicate in a distributed object message
- From: "Doug Knowles" <email@hidden>
- Date: Sun, 28 Oct 2007 22:57:16 -0400
Hi, David,
I tried permutations of your suggestion; when I used "bycopy", I got an
error message I hadn't seen before:
*NSPredicates and NSExpressions cannot be encoded by non-keyed archivers*
This prompted me to try manually archiving the NSPredicate with an
NSKeyedArchiver for bycopy, and (of course) unarchiving it on the other side
of the call, and I'm back in business again. I'd rather not have to jump
through this hoop, but it's good to get past this blockage.
Thanks for the suggestion; besides leading me to the right answer, it
expanded my Cocoa knowledge, which is always a good thing!
Best regard,
Doug Knowles
On 10/28/07, David Spooner <email@hidden> wrote:
>
> Doug,
>
> As a workaround, you might try adding the following in a category on
> NSPredicate...
>
> - (id) replacementObjectForPortCoder:(NSPortCoder *)coder
> { return [coder isBycopy] == NO ? [NSDistantObject
> proxyWithLocal:self connection:[coder connection]] : self; }
>
> dave
>
> On 28-Oct-07, at 12:23 PM, Doug Knowles wrote:
>
> > Hi, all,
> > I'm updating an application to Leopard, and some existing
> > functionality got
> > broken:
> >
> > I use distributed objects to communicate between my main thread and a
> > background thread that manages Spotlight metadata queries; the
> > method used
> > to initiate a query is:
> >
> > - (void)initiateQueryForID:(NSString *)recID
> > withPredicate:(NSPredicate*)pred andScopes:(
> > NSArray *)scopes;
> >
> > This worked fine under Tiger, but the background thread hangs when
> > it tries
> > to use the NSPredicate value. Inspecting the object from within the
> > called
> > routine isn't telling me much. It appears to be an NSProxy, which I
> > expect,
> > but I can't print the description or the className of the object. The
> > member variable "_remoteClass" of the proxy is nil, which doesn't feel
> > right...
> >
> > I've tried changing the protocol and method declarations to:
> >
> > - (void)initiateQueryForID:(bycopy NSString *)recID withPredicate:
> > (bycopy
> > NSPredicate *)pred andScopes:(bycopy NSArray *)scopes;
> >
> > Oddly, I still seem to be receiving a broken proxy object in the
> > called
> > routine.
> >
> > Again, these problems are new to Leopard.
> >
> > TIA,
> >
> > Doug Knowles
> > _______________________________________________
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden