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?
It's a new week. I believe many people check ...
Exercise is one of the most effective ways to rev...
As one of the top ten ice and snow tourism cities...
The second phase of the advanced watercolor illus...
The hottest thing in the past two days is the Jie...
For the delicate little fairy, There is something...
According to statistics from the Ministry of Publ...
Shenzhen beauty mini program customization price ...
User cases are common promotional materials, and ...
Drinking too much, playing cards, and staying up ...
In Android, directly killing the application proc...
When it comes to the most powerful monster in Jou...
I wrote an article before, "Nine Characteris...
A friend recently told me an interesting phenomen...
The original intention of globalization strategy ...