Block pointer variable 'block' is uninitialized when captured by block
I'm using the code seen here to execute code periodically:
#define DELAY_IN_MS 1000
__block dispatch_time_t next = dispatch_time(DISPATCH_TIME_NOW, 0);
void (^block)(void) = ^ // Get warning here!
{
next = dispatch_time(next, DELAY_IN_MS * 1000000L);
// Do my periodic thing ...
dispatch_after(next, queue, block);
}
This results in a warning (see title). I have two questions:
What does it mean?
Why does the warning go away when I write: void (^block)(void); block = ^?
No comments:
Post a Comment