INTERFACE
@interface MyClass
@property (nonatomic, copy) SomeBlock someBlock;
@end
IMPLEMENTATION
- (void)myMethodWithBlock:(SomeBlock)theBlock
{
self.someBlock = theBlock;
[someHelper doSomethingWithCompletionBlock:^(){
self.someBlock(arg1);
}
}
Where self.someBlock(arg1) gives me EXEC_BAD_ACCESS, I did define someBlock to be copied.
What can be the problem?
So it looks like the block is sometimes
nil. When a block is invoked, it’s dereferenced, but dereferencingnilandNULLcrashes the app. Check forif (self.someBlock != nil)and it should not crash anymore.