Why is this not working?
NSString *username = [[GKLocalPlayer localPlayer] alias];
random(); {
int text = rand() % 4;
switch (text) {
case 0: mainTextController.text = username,@"LEOONS"; break;
case 1: mainTextController.text = username,@"AAIING"; break;
case 2: mainTextController.text = username,@"AALBES"; break;
case 3: mainTextController.text = username,@"AALDIJK"; break;
default:
break; }
}
tried with different setups but just won’t work
The issue is
mainTextController.text = username,@"LEOONS";. Comma does not concatenate Objective-C string objects (nor C strings, for the record). What you mean is:(Further info on how the comma works in C: http://en.wikipedia.org/wiki/Comma_operator. I believe in this case, you’re setting
texttousernameand then evaluating, but not using the result of,@"LEOONS".)