Use background
As a developer, I'm not writing BUG,Just writing BUG On my way. Small and medium-sized companies, in particular, are usually understaffed, the development process is imperfect, and the test scenario cannot cover all of them. Although I suggest that I should write less every time I modify old functions and make new functions BUG,Students will also test back before going online, but they still can't avoid some missed fish. How to quickly find, locate and solve problems after going online is a challenge for our developers. Xuebao is a synchronous learning tool for all subjects of Chinese, mathematics and English for primary and secondary school students APP. Since the first edition was launched in 2014, Android and iOS Statistics of end simultaneous access to Alliance SDK,It is used for daily data statistics and retention analysis. With these services, the company saves a lot of costs. Youmeng statistics SDK It can also collect APP The crash information helps us find problems and locate problems quickly after the product is launched. What our developers need to do is to quickly solve problems and improve the user experience.
SDK integration
The following is to learn treasure APP iOS End as an example, the example is used in daily use U-APM Discovery and resolution BUG Process. First, if you don't have an account, you should register a Youmeng account and create your application appkey.
If you are integrating for the first time, it is recommended to use Cocoapods to integrate, then add the following contents to the Podfile file of your project, and finally enter the root directory of the project at the terminal and execute the pod install command. Because UMAPM depends on UMCommon and UMDevice components, it should be put in. For the first integration, it is recommended to add UMCCommonLog. Check the console log to confirm whether the integration is successful. After successful integration, it can be removed.
pod 'UMAPM', '~> 1.4.2'
pod 'UMCommon', '~> 7.3.5'
pod 'UMDevice', '~> 2.0.4'
pod 'UMCCommonLog', '~> 2.0.2'
stay AppDelegate.m Import header file from file #Import < umcommon / umcommon. H >, only one line of code is needed to successfully integrate U-APM into the project. If the UMCCommonLog component is integrated, and [UMConfigure setLogEnabled:YES] is added to view the log on the console, the U-APM integration can be easily completed
[UMConfigure initWithAppkey:@"xxxxxxxx" channel:@"App Store"];
[UMConfigure setLogEnabled:YES];
U-APM Default on Crash Monitoring, Caton monitoring, startup monitoring, memory monitoring and OOM For monitoring, you can also turn off some functions by controlling the attribute value and adjust them according to your own needs.
[UMAPMConfig defaultConfig].crashAndBlockMonitorEnable = YES; // Crash & Caton monitoring
[UMAPMConfig defaultConfig].launchMonitorEnable = YES; // Start monitoring
[UMAPMConfig defaultConfig].memMonitorEnable = YES; // Memory monitor
[UMAPMConfig defaultConfig].oomMonitorEnable = YES; // OOM monitoring
The whole access process is very simple. More methods and problem classes jump to the official documents https://developer.umeng.com/docs/193624/detail/194595 ?&utm_source=w_MKT_dswz_dxf_wz
solve the problem
The following error list can be filtered out according to version, time, equipment and other dimensions.
Take a common array cross-border Crash as an example. This is an unnecessary BUG. This problem was not found during the self-test and test students' test. After going online, multiple records were received in the U-APM background.
Application threw exception NSRangeException: * -[__NSArrayM objectAtIndexedSubscript:]: index 2 beyond bounds [0 .. 1]
Open the error details page, and you can see that the same problem of sending is counted here. According to the behavior log, you can see the last 10 pages viewed before the crash, and you can know the path the user has traveled and the page on which it happened.
Although we know which page to flash back on, these are not enough. A page may have multiple sub pages. How to know which class and row we need to upload the symbol table. Find the dSYM file in our packaged Archive file and copy it to the desktop, then click the symbol table management on the right of the error details to upload the copied dSYM file.
After the upload is successful, the parsing result cannot be seen immediately. It takes a few minutes to parse, usually about five minutes.
After parsing, you can clearly locate the specific class and line. In touchesBegan:withEvent: there is an array value operation without security verification. Just add it.
summary
At the beginning of the year, the statistics of friends League was upgraded SDK When I found the collection Crash The function of has been extracted from the statistics component of Youmeng, reconstructed into an independent component, collected flash back logs in multiple dimensions, and listed the paths of the last 10 pages in the error details. The function is great, which is very helpful to reproduce these problems. As a developer, while writing logic carefully and rigorously, we should also use some auxiliary tools to collect information that is not considered Crash,promote APP Stability. For the mobile terminal, Youmeng SDK And a series of tools are a good choice. They can save manpower and costs. If you encounter some problems in use, the customer service response speed is really fast. It may be the only one in China at present SDK Regular maintenance and updates, as well as customer service businesses, but also free of charge.
Small suggestions
U-APM It is being iterated. As an in-depth user, it will encounter some problems in use. Although it does not affect the use, I believe everyone feels the same. I still look forward to optimizing the following problems.
1. Entering the U-APM panel can display the crash data of the last 24 hours by default, rather than the data of the last hour
Take our own example: our users' active time is concentrated between 7:00 and 9:00 at night. If I arrive at the station one morning, I'll check it APP For the crash situation, it may be 0 after clicking in. It needs to be screened again. How can it not be joint debugging or grayscale? Normally, the default of one hour is of little significance.
2. The crash information details panel model and usage time can be more intuitive
As shown below, in the error details iPhone10,3 The corresponding familiar model is iPhone X,If you don't check the information, you don't know iPhone10,3 Which model is it? Here we prefer to see the common model types. Sometimes when I want to know the user's usage time, I see 6345 s You still have to turn on the calculator of your mobile phone to convert it. If the expected time is more than one minute and less than one hour, it will be converted into minutes (e.g. 3 minutes and 20 minutes). If the expected time is more than one hour and less than one day, it will be converted into hours (e.g. 23 hours and 48 minutes). If the expected time is more than one day, the number of days will be displayed (e.g. 3 days and 10 hours).
3. Can support custom errors
There are some problems that will not cause a crash, but what users see is a problem. There may be a problem with the individual data returned from the background. At this time, there is a need to define an error. Just like solving the problem of array out of bounds in the example, there should be two arrays with the same length in the field returned the day after tomorrow, but the size of the returned array is different because of problems caused by individual data entry.
4. Solve the flash back problem when integrating SDK in new iOS projects
use Xcode 11 Create a new project in the above version and integrate it SDK The operation flashed back directly. Of course, an experienced search can also be solved quickly, but for a novice who has just contacted, this flash back is still very sudden. I hope it can be explained in the document. A better solution is to SDK Internal compatibility repair.
Author: Du Xinfeng