我在实现对象的实现中实现了 C 回调,该对象由私有框架中的函数使用,因此我无法控制传递给回调的参数。我想self
从回调中使用。谢谢。
编辑:
我的对象.h/.m
#import "PrivateFramework.h"
@interface MyObject : NSObject
-(void) start;
@end
void callback(void* arg1, int arg2);
void callback(void* arg1, int arg2) {
/*
here I would like to use self (current instance of the object) but
I can't pass a pointer to the instance in the callback since I don't
control what is passed to it.
*/
@implementation MyObject
-(void)start {
// this function is inside a private framework.
PrivateFunction(&callback);
}
@end