• 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
Re: Odd behaviour with NSInvocation, performSelectorOnMainThread and NSClassFromString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Odd behaviour with NSInvocation, performSelectorOnMainThread and NSClassFromString
      • From: Duncan McGregor <email@hidden>
References: 
 >Odd behaviour with NSInvocation, performSelectorOnMainThread and NSClassFromString (From: Duncan McGregor <email@hidden>)

  • Prev by Date: Odd behaviour with NSInvocation, performSelectorOnMainThread and NSClassFromString
  • Next by Date: Re: IKImageView Behavior
  • Previous by thread: Odd behaviour with NSInvocation, performSelectorOnMainThread and NSClassFromString
  • Next by thread: Re: Odd behaviour with NSInvocation, performSelectorOnMainThread and NSClassFromString
  • Index(es):
    • Date
    • Thread