cocoa - Passing a native pointer to performSelectorOnMainThread's withObject argument? -


I want to pass a point to the C ++ object, the selector using selectSelectorOnMainThread. The pointer's casting does not seem to work just in 'id' (objc_object *). I can always write my own self-envelopment class, but there must be a very standard way of doing this.

What is the best way to do this?

What do I want to do here:

  ... Foo * foo = new Foo (); // fu a C ++ class MyObject * myObj = [[MyObject alloc] init]; // Obj-C Class [myObj performSelectorOnMainThread: @selector (some method) withObject: foo waitUntilDone: NO]; ...  

Thanks!

No need for your wrapper class; [NSValue valueWithPointer:] Designed for Boxing Points. Just take any method to NSValue instead of a raw indicator, and then remove the pointer from the pointer value.

(I believe that performSelector * methods retain their argument so that the object is guaranteed to be final through call, this is the reason that in that logic, the ID is a random value Can not be inserted.)


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -