Question

I have a list of textfields which when you press the return button it goes to the next one until it gets to the one when it gets rid of the keyboard. This all works fine for me though when I go through the list really quickly the app crashes and I get this error:

*** Assertion failure in NSDictionary *_UIRecordArgumentOfInvocationAtIndex(NSInvocation *, NSUInteger, BOOL)(), /SourceCache/UIKit/UIKit-2380.17/UIAppearance.m:1118

Here is the code which I use to switch between textfields:

-(BOOL) textFieldShouldReturn:(UITextField *)textField {
    if (textFieldNo == i) {
        [textField resignFirstResponder];
    } else {
        [[self.view viewWithTag:textFieldNo + 1] becomeFirstResponder];
    }
    return NO;
}

Please can I have some advice on how to sort this issue

Thanks in advance

Edit

It turns out it wasn't me going through the textfields quickly which was causing the error in fact it was that when I resigned it I accidentally pressed the ad beneath. This has is only a recent issue and I am curious to find out why this behaviour is taking place

Was it helpful?

Solution 2

I found out the answer was completely unrelated to the title of the question with the solution being that, as the app works in ios 6 and 7 I had some title which only worked in ios 7 and when it opened the ad it crashed because of this.

OTHER TIPS

Try returning YES after resigning:

   -(BOOL) textFieldShouldReturn:(UITextField *)textField {
        if (textFieldNo == i) {
           [textField resignFirstResponder];

        } else {
            [[self.view viewWithTag:textFieldNo + 1] becomeFirstResponder];

        }
        return YES;
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top