Gdb remote returned an error: E08 when calling the termination block (EXC_BAD_ACCESS)

I use ARC on iOS6 as well. I find it a little strange: gdb remote returned an error: E08

In stacktrace, the before method is on the line that calls the completion block. I read a lot about blocks and ARC, but I'm still not sure about using them in context:

(simplified methods and some codes are excluded)

- (void) method1: (void(^)(NSMutableArray *a)) completionBlock withFailedBlock:(void(^)(NSInteger errorCode,NSString *error)) failedBlock { __weak Controller *weakSelf = self; ... if(condition) completionBlock(weakSelf.a); //still do method2, since we might get updated data [weakself.service method2:^(NSMutableArray *a2) { weakSelf.shouldRefresh = NO; ... completionBlock(a2); //<-- sometimes crashes here } withFailedBlock:^(NSInteger errorCode, NSString *error) { failedBlock(errorCode, error); }]; } withFailedBlock:^(NSInteger errorCode, NSString *error) { failedBlock(errorCode, error); }]; 

call code:

 [[Controller sharedController] method1:^(NSMutableArray *a) { //save result in model (singleton) [Model sharedModel].a = a; [weakSelf refreshUI]; } withFailedBlock:^(NSInteger errorCode,NSString *error) { ;//show alert }]; 

When I check the block and the values ​​around it, they look fine. I also have an NSZombie. My lock completion should be automatically copied as it is referenced inside the block.

What am I missing here? I saw crashes on iOS5 and 4.3, but never deleted gdb remote: E08. Information from the debugger also did not help in these cases. I use PLWeakCompatibility to support __weak under iOS4.3

+8
objective-c automatic-ref-counting ios6 objective-c-blocks
source share
1 answer

Do you still have this problem?

Why do you need a weak self in this case. It does not look like you are capturing yourself in this situation. Does the code encode when you leave it?

btw, I think your implementation of method1 got a little confused when you tried to simplify it for your question.

 - (void) method1: (void(^)(NSMutableArray *a)) completionBlock withFailedBlock:(void(^)(NSInteger errorCode,NSString *error)) failedBlock { ... } withFailedBlock:^(NSInteger errorCode, NSString *error) { ... }]; 

Not like the actual implementation of the method. There should not be something like:

 - (void) method1: (void(^)(NSMutableArray *a)) completionBlock withFailedBlock:(void(^)(NSInteger errorCode,NSString *error)) failedBlock { ... } 
0
source share

All Articles