Are you telling UITextField to become a selector in the background thread?
[textField performSelectorOnMainThread:@selector(becomeFirstResponder) withObject:nil waitUntilDone:YES];
Justification . Calling UIKit methods (i.e. updating the view) using a method other than the main thread will not work. This may happen. (It is unclear where the addTitleTextField method is called from.)
Is there another defendant who needs some time to resign?
[textField performSelectorOnMainThread:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0]
Justification . If another field hangs on the first responder (or during the process of its resignation), it will give time to clear the resignation, waiting for the next cycle of the cycle., Usually the next cycle of the cycle will be sufficient to clear the previous responder, or you can try a short delay, for example, 0.05.
source share