Amelia frensheo Amelia frensheo - 2 years ago 364
Objective-C Question

How to check for <object returned empty description check> in uitextfield?

I have a uitextfield and i have got a search option using this uitextfield.When i enter the text it works well but when i clear the text i get "object returned empty description check" when i print it using po command in console. For checking this i have used the following code:

if(_nameTextField.text !=nil || _nameTextField.text.length !=0 || ![_nameTextField.text isEqual:@""]|| _nameTextField.text != NULL || ![_nameTextField.text isEqualToString:@""]){


But still it enters into the loop

Answer Source

use && instead of ||

if(_nameTextField.text !=nil && _nameTextField.text.length !=0 && ![_nameTextField.text isEqual:@""]&& _nameTextField.text != NULL && ![_nameTextField.text isEqualToString:@""]){

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download