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?
I believe that many operators will encounter this...
[[161361]] Wishes don't always come true, but...
[[122293]] Google uploaded the latest Android 5.0...
Produced by: Science Popularization China Author:...
Introduction to the science and technology busine...
Simply put: the so-called WeChat SEO optimization ...
Patients with chronic respiratory diseases often ...
Both iOS and Android have been released for nearl...
Nowadays, most of our SEM promotions revolve arou...
Recently, Mr. Wang from Hankou had a very profoun...
As live streaming becomes more and more popular, ...
At a press conference held by the State Council I...
As time goes by, the post-90s generation has grad...
Some time ago, I translated Future Studio's R...
What is your main reason for drinking coffee? Is ...