Okay, I’ve worked a bit more on the reproduction project and I can indeed get the behavior with the new project. It’s random in my main project and it’s also random in the repro project. I wasn’t able to eliminate the randomness, so it might be you have to start the app 10 times and it does not happen and then it does happen.
It’s very important that you restart the app after every try, as the biggest lag only happens once. Afterwards the lags get way way smaller.
Link to new repro project:
I edited UIEditBoxImplIOS to add a log for how long it takes to do the openKeyboard call:
void EditBoxImplIOS::nativeOpenKeyboard()
{
CFTimeInterval startTime = CACurrentMediaTime();
[_systemControl setVisible:YES];
[_systemControl openKeyboard];
CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime;
NSLog(@"This took %f seconds", elapsedTime);
}
Here’s the result of five subsequent tries (restart and first tap on the edit box):
2017-04-01 13:35:12.536643 EditBoxIssue-mobile[655:156416] This took 0.935062 seconds
2017-04-01 13:36:59.281055 EditBoxIssue-mobile[661:157419] This took 1.641139 seconds
2017-04-01 13:38:58.581670 EditBoxIssue-mobile[665:157752] This took 20.313935 seconds
2017-04-01 13:40:09.509423 EditBoxIssue-mobile[670:158587] This took 3.671407 seconds
2017-04-01 14:04:56.089067 EditBoxIssue-mobile[239:5534] This took 0.149004 seconds
On the third try it took 20 (!) seconds until the keyboard opened. Unfortunately, I didn’t video tape it and I didn’t get a delay of that length afterwards…but I started video taping and got the ~3.6 seconds delay on video.
Even though not 20 seconds, I believe that every delay greater than ~200 ms is already unbearable and very noticeable for the user. Hence also the ~1-3 seconds that I measured should never happen.
In my main project there’s much more pressure on the CPU due to way more draw calls and sprites…but it seems like even this very minimal demo project is sufficient to get the error a reasonable amount of time.
In case you can not reproduce it on your iPhone, maybe you can also try it with an iPad. It feels like it’s easier to get it on iPad even though I also get it on iPhone.