Reference :
https://stackoverflow.com/a/14741253/1749293
Like the link above said , but it seems that it doesn't explain the reason.
In my code, the following will work :
dispatch_async(dispatch_get_main_queue(), ^{
[self performSelector: @selector(helloWorld) withObject:nil afterDelay:0.5];
});
but, when i comment something like this , (and I really sure that I run it in the main thread!!)the code doesn't work :
// dispatch_async(dispatch_get_main_queue(), ^{
[self performSelector: @selector(helloWorld) withObject:nil afterDelay: 0.5];
// });
Can somebody tell me why ? AND ' self ', will nerver release/deallocated , i retain it until the application is over.
" Not Working " , means that , (no crash) it doesn't jump into "helloWorld" method :
-(void) helloWorld {
NSLog(@"hello world"); // I set a break point here for debug , it wouldn't pause forever
}
I think is the Run Loop cause this problem . Like this link said , but i need more details or more explicit explain.