MY BAD I WAS ACTUALLY WRITING THIS CODE OUTSIDE IMPLMENTATION, WHAT A BIG NAIVE MISTAKE
I am learning GCD queues and creating blocks to run in background,
-(IBAction) refresh:(id) sender
{
dispatch_queue_t downloadQueue = dispatch_queue_create("app data", NULL);
dispatch_async(downloadQueue, ^{
//. . . Call a method which download XML file from server . . .
dispatch_async(dispatch_get_main_queue(), ^{
//. . . Update UI with dowanloaded data . . .
});
});
dispatch_release(downloadQueue);
}
but this line of code is showing compile error
dispatch_queue_t downloadQueue = dispatch_queue_create("eiap data", NULL);
ERROR: initialiser element is not a compile-time constant
I can say that something is wrong with “app data” a const char which I am creating kind a on the fly, But I don’t know what is wrong with it?
Thanks
If I do this, it compiles:
but if I do this, I get exactly the error you mention:
I think you’re declaring it static. Or you’re actually declaring it outside the method body, as a global variable.