Foreword:
Whenever there are big promotions like 618 and Double 11, search, as the core function of the entire app, not only serves as the traffic entrance, but also carries the service and experience that users perceive this product in the shopping guide scene, so guarantee search to better help 618 sell well.
Phenomenon:
Double-click the Sogou input box to invoke the keyboard crash
monitoring platform:
The monitoring platform detects a large number of crashes, and the phenomenon is that the keyboard responds in a very short time interval.
Mental journey:
- By observing the phenomenon, it is guessed that the user copied the keyword through WeChat or other software , and then came to JD Wanshang to paste the search function. It may be due to some reasons (the copy permission prompt pop-up window did not pop up) that the paste function did not appear in the search box, and the user frantically double-clicked the input box at this time. So I started to test the apps on the market. Taking JD App as an example, the steps to reproduce are as follows:
- The test results are as follows:
App | Does it crash | frequency |
---|---|---|
Jingdong | yes | high |
JD.com | yes | high |
seven fresh | yes | high |
Taobao | no | |
Alipay | yes | middle |
baidu | yes | middle |
Baidu map | no | |
meituan | no | |
Hema | no | |
1688 | no | |
Bilibili | no | |
Tik Tok | yes | Low |
- The crash logs obtained through mobile phone privacy are Jingme, Jingdong, Baidu , and the performance is the same as that of the SGM platform.
Source code debugging:
- Debugging results through Xcode breakpoints are as follows:
- UICompatibilityInputViewController excessive release
- crash in
_wantsForwardingFromResponder:toNextResponder:withEvent
solution:
- Give the crash method a default implementation through the runtime pair
static BOOL (*originalImpl)(id, SEL, UIResponder*, UIResponder*, UIEvent* ) = nil;
- (BOOL)_wantsForwardingFromResponder:(UIResponder *)arg1 toNextResponder:(UIResponder *)arg2 withEvent:(UIEvent *)arg3 {
NSString* responderClassName = NSStringFromClass([arg2 class]);
if ([responderClassName isEqualToString:@"_UIRemoteInputViewController"]) {
bool isDeallocating = false;
// isDeallocating = _objc_rootIsDeallocating(arg2);
// Use 'performSelector' when u are develop a App-Store App.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
SEL sel = NSSelectorFromString(@"_isDeallocating");
isDeallocating = [arg2 respondsToSelector:sel] && [arg2 performSelector:sel];
#pragma clang diagnostic pop
if (isDeallocating) {
NSLog(@"BingGo a deallocating object ...");
return true;
}
}
BOOL retVal = FALSE;
if (originalImpl == nil) {
IMP impl = [ObjcSeeker seekInstanceNextOirignalImpl:self selector:_cmd];
originalImpl = (BOOL (*)(id, SEL, UIResponder*, UIResponder*, UIEvent* ))impl;
}
if (originalImpl != nil) {
retVal = originalImpl(self, _cmd, arg1, arg2, arg3);
}
return retVal;
}
Reference link:
https://github.com/SnowGirls/Objc-Deallocating
The 8 most in-demand programming languages in 2023: PHP is strong, C/C++ demand is slowing Musk announced that Twitter will be renamed X, and the logo will be changed for five years, Cython 3.0 is officially released GPT-4 is getting more and more stupid? The accuracy rate dropped from 97.6% to 2.4%. MySQL 8.1 and MySQL 8.0.34 were officially released. The father of C# and TypeScript announced the latest open source project: TypeChat Meta Enlargement move: released an open source large language model Llama 2, which is free for commercial use . React core developer Dan Abramov announced his resignation from Meta. ChatGPT for Android will be launched next week. Pre-registration starts now . needs? Maybe this 5k star GitHub open source project can help - MetaGPTAuthor: JD Retail Tu Shizhan
Source: JD Cloud Developer Community
{{o.name}}
{{m.name}}