iOS块变成僵尸

时间:2016-11-23 10:00:07

标签: ios

我已将方法作为块传递,我的功能就是这样。

- (void)setPhoneNumber:(NSString *)phoneNo andView:(UIView *)view andSuccessBlock:(void (^)(id responseObject))successBlock andFailureBlock:(void (^)(NSString *errorMsg, NSInteger errorCode, AFHTTPRequestOperation *operation, NSError *error))failureBlock {

}

我这样打电话。

    [[WSHelper sharedInstance] setPhoneNumber:phoneNumber andView:nil andSuccessBlock:^(id responseObject) {

    } andFailureBlock:^(NSString *errorMsg, NSInteger errorCode, AFHTTPRequestOperation *operation, NSError *error) {

    }];

问题是,当我检查successBlock时,它被释放(我使用的是arc,不应该像那样发布)。我尝试过typedef也不行。在我的其他项目中,这工作正常,但只有在这里,它不是好的。我怎么解决?

  

(lldb)po successBlock
  0x00000001078063c0

1 个答案:

答案 0 :(得分:0)

您尚未在块中添加代码。但我想知道那里的某些东西是否会导致循环引用。我会尝试分配应用程序的分析,并记录所有保留打开。这将显示保留发生的位置,(运气稍稍)将指出问题所在。