0
沒有太多的判斷,這個代碼的設計,我想知道如何解決我創建了保留週期...類塊實例變量
@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;
}
是的。這絕對是有道理的。謝謝。 – edelaney05