When I try to change the hidden value of a button with performSelectorOnMainThread this works:
[pictureButton performSelectorOnMainThread:@selector(setHidden:) withObject:NO waitUntilDone:YES];
But this:
[pictureButton performSelectorOnMainThread:@selector(setHidden:) withObject:YES waitUntilDone:YES];
Gives this error:
Cannot initialize a parameter of type 'id' with an rvalue of type 'signed char'
What kind of internal conversion occurs to create this error? And how can I solve this?
The parameter is named
withObject:. A BOOL isn’t an object, butnilcan be passed in, andNOis equivalent to it, so your first example works (by accident).You have a few options, but the simplest is probably to use GCD and execute the setHidden: method in a block on the main thread instead.