【发布时间】:2012-05-02 02:43:19
【问题描述】:
没有过多判断此代码的设计,我想知道如何解决我创建的保留周期...
@interface BlockClass : NSObject
{
id actualObject;
NSError *actualError;
void (^block)(id, NSError *);
}
@end
@implementation BlockClass
- (id)init
{
self = [super init];
if (self) {
block = ^(id object, NSError *error){
actualObject = object; // Compiler warns: capturing 'self' strongly in this block is likely lead to a retain cycle
actualError = error;
};
}
return self;
}
【问题讨论】:
标签: objective-c automatic-ref-counting objective-c-blocks