found this in apple discussions when looking for the same thing, thought it was bad too. check the string length:
NSString *value = textField.text;
if([value length] == 0) {
}
or optionally trim spaces from it before validation, so the user cannot enter spaces instead. Good for usernames.
NSString *value = [textField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if([value length] == 0) {
}
source
share