传递带有Objective-C(Cocoa)事件(performSelector)的C ++对象

传递带有Objective-C(Cocoa)事件(performSelector)的C ++对象

问题描述:

如何使用performSelector方法传递C ++对象?这个方法只允许你传递objc_object *对象,我不能投射它们。我可以构建一个包装器,但我不知道所有C ++对象的整体超类,所以我不知道我如何能够构建一个通用包装器(我不想在包装器中的对象的具体知识)。

How to pass a C++ object with the performSelector method? This method only allows you to pass 'objc_object*' objects, I can't cast them. I could build a wrapper, but I don't know the overall superclass for all C++ objects, so I don't know how I could build a generic wrapper (I don't want specific knowledge about the object in the wrapper)..

任何提示?

尝试使用+ [NSValue valueWithPointer :]

Try just using +[NSValue valueWithPointer:].