Passing a native pointer to execute an argument SelectorOnMainThread withObject?

I want to pass a point to a C ++ object for a selector called using the performSelectorOnMainThread function. Just hovering over the "id" pointer (objc_object *) does not seem to work. I could always write my own C shell object class, but there should be a pretty standard way to do this. In fact, I did not find anything in the documentation for Apple.

What is the best way to do this?

Here is what I want to do:

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

Thanks!

+3
source share
1 answer

-; [ NSValueWithPointer:] . someMethod NSValue , pointerValue.

( , performSelector * , , , id .)

+5

Source: https://habr.com/ru/post/1713590/


All Articles