Preface After the release of iOS 11, a series of adaptation-related issues have emerged, such as the insensitive sliding gesture of UIScrollView when pagingEnabled=YES, the sliding deletion function of UITableView changed, and the click area of the cancel button of UIImagePickerViewController became smaller. This article introduces one of the UIAlertView issues and shares its discovery, location, and solution. text 1. Problem The problem first occurred shortly after the official release of iOS 11. A tester reported an iOS 11-related bug. When sending a chat message in the live broadcast room, if the user is banned, a "banned" prompt will pop up, the keyboard will retract, and then it will not pop up again. When the developer received this BUG, he first abstracted the problem into several elements: inside the live broadcast room, keyboard pop-up, pop-up prompt, keyboard retracted, and keyboard unable to pop up. The pop-up prompt uses the UIAlertView method. When the keyboard appears, the UIAlertView prompt pops up, and the keyboard will be retracted. After the UIAlertView disappears, the keyboard will pop up again, which is a normal performance. 2. Problem reproduction Make an attempt according to the recurrence path and find that the BUG can be reproduced, confirming that the problem exists;
After trying other main scenes other than the live broadcast room, I found that the problem can be described as:
3. Problem Assessment
4. Problem Analysis The external version is compiled by Xcode8, and the local version is compiled by Xcode9 GM. Could it be caused by Xcode 9 compilation?
It can be determined that some code in the app causes the keyboard to not pop up. Through binary annotation, we quickly (about 4 or 5 times) located that the problem was caused by a Service class in the app. After carefully arranging the properties of the Service class, I found that there is a property that inherits UIWindow and its level is higher than UIWindowLevelStatusBar. From here, based on what we’ve learned and Apple’s UIKit documentation, we can backtrack the problem. 5. Problem tracing The description of the response chain and UIWindow on Apple's official website explains becomeFirstResponder() as follows: Asks UIKit to make this object the first responder in its window. For iOS 11 system behavior of UIAlertView, guess:
By writing code and debugging the app, the above guess was confirmed. In iOS 11, if there is a UIWindow with a windowLevel greater than UIWindowLevelNormal when UIAlertView pops up, it will trigger a bug that prevents the keyboard from popping up. 6. Problem fixes
Summarize
|
>>: Windows Phone is dead, but why don't we feel sorry for it?
March 10 news, according to foreign media reports...
Today, there was news online that "WeChat ha...
If you plan to test growth hacking techniques, st...
In the past, the transportation was slow, the let...
We have seen too many marketing routines and case...
ClipboardManager ClipboardManager is a system ser...
The first part of the "Emotional Cycle Strat...
The article series "Designing an App from Sc...
Recently, news about my country's plan to esta...
What content is most likely to dominate TikTok ? ...
Product highlights: small and portable, built-in ...
What are the true colors of the James Webb Space ...
There are many discussions about whether to use b...
"The industrialization of electric vehicles ...
1. The most sentimental and creative: Pepsi's...