如何得到结构体指针成员变量的值
@interface DisplayConnection : NSObject
{
UIView *_view;
struct UnityDisplaySurfaceBase *_surface;
}
@property(readonly, nonatomic) struct UnityDisplaySurfaceBase *surface;
@property(readonly, copy, nonatomic) UIView *view;
@end
//得到成员变量:
id value = [instance valueForKey:@“_view”];//正常
id value = object_getIvar(instance, _viewIvar);//正常
id value = [instance valueForKey:@“_surface”];
或
id value = object_getIvar(instance, _surfaceIvar);
报错:
valueForUndefinedKey this class is not key value coding-compliant for the key XXXX
id value = [instance propertyForKey:@“view”];//正常
id pp = [ii propertyForKey:@“surface”];
报错:
unrecognized selector sent to instance xxxxxxxx
id value = objc_msgSend(instance, @selector(surface));
//直接崩溃而且不能捕获错误
如何才能得到结构体指针成员变量的值?