Re: Odd behaviour with NSInvocation, performSelectorOnMainThread and NSClassFromString
Re: Odd behaviour with NSInvocation, performSelectorOnMainThread and NSClassFromString
- Subject: Re: Odd behaviour with NSInvocation, performSelectorOnMainThread and NSClassFromString
- From: Peter Ammon <email@hidden>
- Date: Fri, 16 Nov 2007 14:49:06 -0800
On Nov 16, 2007, at 2:26 PM, Duncan McGregor wrote:
void* result = malloc([methodSignature methodReturnLength]); // TODO
[invocation getReturnValue: result];
NSLog(@"performSelectorOnMainThread returning %@", result);
-[NSInvocation getReturnValue:] takes a pointer to the buffer in
which to store the return value. The return value in your test is of
type Class, so after the call to getReturnValue:, you should think of
the variable with identifier "result" of having type pointer-to-Class.
To get the actual return value, dereference the result: Class
returnValue = *(Class *)result.
All ObjC objects also have a Class as the first word. That is why the
log message indicates that you have a real QTMovie - the intial
layout of your pointer-to-class buffer happens to match the layout
for an ObjC object. It is not, however, a real object.
Hope this makes sense,
-Peter
_______________________________________________
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