我正在尝试从 NSProxy 的 forwardInvocation 中的 NSInvocation 获取 block 参数:这是正确的语法吗?它会泄漏内存吗?
typedef void(^SuccessBlock)(id object);
void *successBlockPointer;
[invocation getArgument:&successBlockPointer atIndex:index];
SuccessBlock successBlock = (__bridge SuccessBlock)successBlockPointer;
还是我应该使用?
typedef void(^SuccessBlock)(id object);
SuccessBlock successBlock;
[invocation getArgument:&successBlock atIndex:index];
像对象这样的其他参数类型呢?
__unsafe_unretained id myObject = nil; // I don't think this could be __weak? Is that correct?
[invocation getArgument:&myObject atIndex:index];
我是否必须做其他事情才能正确释放分配的内存?
提前致谢。