Question

I recently updated XCode (4.2 with iOS5 SDK) and now my app is throwing EXC_BAD_ACCESS everytime i use "resignFirstResponder".

I'm familiar with memory management and check out that nothing was released before... The crazy part is that "becomeFisrtResponder" would work.

Working fine:

if(_TextField==input){
    [inputPassWord becomeFirstResponder];
}
else
{
    [input becomeFirstResponder];
}

Failing:

if(_TextField==input){
        [inputPassWord becomeFirstResponder];
    }
    else
    {
      [_TextField resignFirstResponder];
    }

Any idea of what it could be?

Thanks!

Was it helpful?

Solution

Not sure if this is going to be of any help but is the logic in the second example right?

The first one looks like you're checking to see which TextField has done something and then setting firstResponder on the other.

The second one seems to do nothing since it's only calling [input resignFirstResponder] if Input is NOT the textField being tested.

Have you tried switching the two lines of code in the second example, or using != instead of ==. Might be worth a try.

I don't think that should cause your problem though but I'm pretty new to this'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top