I have this code:
dispatch_async(dispatch_get_main_queue(), ^(void)
{
SEL selector = @selector(callback:);
[self.delegate performSelector:selector withObject:self];
});
Both self.delegate and self is not nil.
I am getting EXC_BAD_INSTRUCTION at the performSelector line.
Any idea?
Try using the selector directly, and make sure
callback:is a valid method ofself.delegate:Another debugging tip is to set NSZombieEnabled, MallocStackLogging, and guard malloc in the debugger. Then, when your App crashes, type this in the gdb console:
Replace
0x543216with the address of the object that caused the crash, and you will get a much more useful stack trace and it should help you pinpoint the exact line in your code that is causing the problem.See this article for more detailed instructions.