What could possibly be the error in this ??
int flag11 = 1;
if (([self.textField1.text length]>0) &&
([self.textField4.text length]>0) &&
([self.textField3.text length]>0) &&
(([self.textField2.text length]>0) || (flag11)))
{
NSLog(@"Please display me");
// Some statements //
}
Here, first three conditions are TRUE. And the last one should obviously be TRUE because of flag11 being 1.
It breaks out with error Current language: auto; currently objective-c and
(gdb)Program received error: SIGABRT and does not enter inside IF statement as expected.
Note: If I remove flag11, and I have just those four conditions, it works! What I want to know is why does it report an error when flag11 is added to the code.
That’s weird. I made a sample project with 4 textfields and a button hooked up to an action which does your check, and NSLog’s the results and it seemed to work fine. Here’s the code if you want to see:
One thing I got stuck on was that you put textField2 being the one that does not require any text. (lol) I guess the only thing to make sure is that the 4 textfields are hooked up to the right IBOutlet, and that the file’s owner is the delegate for each one as well. Hope that helps!