White screen monitoring method and device based on view component, equipment and medium
By using the white screen monitoring method of view components on the iOS side and using the webview proxy method to monitor and record white screen events in real time, it solves the problem that traditional technology cannot monitor the white screen of H5 containers, and achieves accurate capture and data recording of white screen events. .
Patent Information
- Application Number
- CN202410736347.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-24
AI Technical Summary
Existing technology is difficult to monitor and solve the white screen phenomenon caused by H5 containers during the loading process. Traditional detection methods cannot effectively capture the incomplete rendering of H5, resulting in the inability to monitor and record white screen events.
Adopt the white screen monitoring method based on the view component, by defining the global white screen mark amount and page status mark amount, using the webview proxy method on the iOS side to monitor the loading process of WKWebView or UIWebView, monitor and record the white screen event in real time, and meet the predetermined requirements. Report relevant information when conditions are set.
It achieves comprehensive monitoring and recording of white screen events to ensure no omissions, provides accurate data support, helps businesses accurately locate the number and severity of white screens, and provides good log records for subsequent problem solving.
Smart Images

Figure 00000000_0000
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a white screen monitoring method, device, equipment and medium based on a view component. Background Art
[0002] White screen is often found in online apps. Through existing logs, it is found that the H5 container, that is, WKWebView or UIWebView, has a problem during loading, resulting in a white screen state of the page, which has a huge impact on business development.
[0003] Traditional detection methods can only monitor page loading failures and abnormal situations. Some methods use H5 rendering detection, but because the H5 rendering is not completed in this special scenario, it cannot be monitored. The existing technology lacks a monitoring solution for this situation. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a white screen monitoring method, device, equipment and medium based on view components, which can make full use of the characteristics of the webview proxy method on the iOS side, and completely cover and collect the special white screens under WKWebView and UIWebView, without intruding on the business code. It only performs some seemingly routine but "fatal" precise capture at the core logic of the webview, which provides strong data support for accurately locating the number of white screens for the business and the severity of the online situation, and provides good log records for further solving such problems in the future.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides a white screen monitoring method based on a view component, comprising the following steps:
[0007] Define a global white screen mark and a page status mark, wherein the global white screen mark is used to record the white screen information and the number of times a white screen is generated each time, and the page status mark is used to indicate whether the page status is a white screen;
[0008] In response to an access request for a target link, the view component is loaded, a target page is monitored based on the view component, and the page status mark corresponding to the target page is modified based on the monitoring result;
[0009] In response to the page destruction operation, the page status mark quantity is verified, the white screen information of which the verification result is a white screen is obtained, and the white screen page information is accumulated to the global white screen mark quantity;
[0010] In response to the global white screen mark quantity satisfying a preset reporting condition, the white screen information generated each time a white screen occurs in the global white screen mark quantity is reported.
[0011] In a second aspect, an embodiment of the present application further provides a white screen monitoring device based on a view component, the device comprising:
[0012] A definition module, used to define a global white screen mark and a page status mark, wherein the global white screen mark is used to record the white screen information generated each time and the number of times the white screen is generated, and the page status mark is used to indicate whether the page status is a white screen;
[0013] A monitoring module, for responding to an access request for a target link, loading the view component, performing monitoring processing on the target page based on the view component, and modifying the page status mark corresponding to the target page based on the monitoring result;
[0014] an acquisition module, configured to, in response to a page destruction operation, perform verification processing on the page status mark quantity, obtain the white screen information of which the verification result is a white screen, and accumulate the white screen page information to the global white screen mark quantity;
[0015] The reporting module is used to report the white screen information generated each time a white screen occurs in the global white screen mark quantity in response to the global white screen mark quantity satisfying a preset reporting condition.
[0016] In the third aspect, an embodiment of the present application also provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to execute the white screen monitoring method based on the view component as described in any one of the first aspects.
[0017] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the white screen monitoring method based on the view component as described in any one of the first aspects is executed.
[0018] The embodiments of the present application have the following beneficial effects:
[0019] By defining the global white screen marker, each white screen phenomenon and its occurrence frequency in the application can be recorded, thus providing a comprehensive perspective to detect white screen problems and ensuring that nothing is missed. It can not only comprehensively record the white screen phenomenon and its frequency in the application, but also monitor the page status in real time to ensure a quick response to white screen events. This method makes full use of the characteristics of the webview proxy method on the iOS side to fully cover and collect special white screens under WKWebView and UIWebView, without intruding on the business code. It only performs some seemingly routine but "killing" precise capture in the core logic of the webview, which provides strong data support for the accurate positioning of the number of white screens and the severity of online business, and provides good log records for further solving such problems in the future. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 It is a flowchart of steps S101-S104 provided in an embodiment of the present application;
[0022] Figure 2 It is a flowchart of steps S201-S202 provided in an embodiment of the present application;
[0023] Figure 3 It is a flowchart of steps S301-S302 provided in an embodiment of the present application;
[0024] Figure 4 It is a flowchart of steps S401-S402 provided in an embodiment of the present application;
[0025] Figure 5 It is a flowchart of steps S501-S502 provided in an embodiment of the present application;
[0026] Figure 6 is a structural schematic diagram of a white screen monitoring device based on a view component provided in an embodiment of the present application;
[0027] Figure 7 It is a schematic diagram of the composition structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0028] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0029] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0030] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0031] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0032] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0033] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0034] See also Figure 1 , Figure 1is a flow chart of steps S101-S104 of the white screen monitoring method based on the view component provided in the embodiment of the present application, which will be combined with Figure 1 Steps S101-S104 are shown for explanation.
[0035] Step S101, defining a global white screen mark and a page status mark, wherein the global white screen mark is used to record the white screen information generated each time and the number of times the white screen is generated, and the page status mark is used to indicate whether the page status is a white screen;
[0036] Step S102: in response to an access request for a target link, the view component is loaded, a target page is monitored based on the view component, and the page status mark corresponding to the target page is modified based on the monitoring result;
[0037] Step S103, in response to the page destruction operation, verify the page status mark, obtain the white screen information of which the verification result is a white screen, and add the white screen page information to the global white screen mark;
[0038] Step S104: in response to the global white screen mark quantity satisfying a preset reporting condition, the white screen information generated each time a white screen occurs in the global white screen mark quantity is reported.
[0039] The above-mentioned view component-based white screen monitoring method can record each white screen phenomenon and its occurrence frequency in the application by defining the global white screen marker, thus providing a comprehensive perspective to detect white screen problems and ensure that nothing is missed. It can not only comprehensively record the white screen phenomenon and its frequency in the application, but also monitor the page status in real time to ensure a quick response to white screen events. This method makes full use of the characteristics of the webview proxy method on the iOS side to fully cover and collect the special white screens under WKWebView and UIWebView, without intrusion into the business code, and only performs some seemingly routine but "killing" precise capture in the core logic of the webview, which provides strong data support for the accurate positioning of the number of white screens and the severity of online business, and provides good log records for further solving such problems in the future.
[0040] The above exemplary steps of the embodiments of the present application are described below respectively.
[0041] In step S101, a global white screen mark and a page status mark are defined, wherein the global white screen mark is used to record the white screen information generated each time and the number of times the white screen is generated, and the page status mark is used to indicate whether the page status is a white screen.
[0042] Here, we first define two important markers: the global white screen marker and the page status marker. The global white screen marker is responsible for tracking the relevant information of each white screen event and the number of white screen occurrences, while the page status marker is used to indicate in real time whether the page is in a white screen state.
[0043] In step S102, in response to an access request for a target link, the view component is loaded, the target page is monitored based on the view component, and the page status mark corresponding to the target page is modified based on the monitoring result.
[0044] Here, when the system receives an access request for a target link, the view component is loaded and begins to monitor the target page. Based on the monitoring results, the page status marker is modified accordingly to accurately reflect the current page status.
[0045] In step S103, in response to the page destruction operation, the page status mark is verified, the white screen information of which the verification result is a white screen is obtained, and the white screen page information is accumulated to the global white screen mark.
[0046] Here, when the page is destroyed, the system will perform a verification process to check whether the page status mark indicates a white screen state. If the verification result confirms a white screen, the relevant white screen information will be obtained and accumulated into the global white screen mark.
[0047] In step S104, in response to the global white screen mark quantity satisfying a preset reporting condition, the white screen information generated each time a white screen occurs in the global white screen mark quantity is reported.
[0048] Finally, once the global white screen mark quantity meets the preset reporting conditions, the system will trigger the reporting mechanism to report the white screen information generated by each white screen event.
[0049] In some embodiments, the view component is WKWebView or UIWebView, and before defining the global white screen mark and the page status mark, the method further includes:
[0050] For WKWebView or UIWebView, implement at least one target method under the target requirement to implement the standard proxy protocol corresponding to WKWebView or UIWebView. The at least one target method includes the following methods:
[0051] didStartProvisionalNavigation method, didFailProvisionalNavigation, didFinishNavigation method, didFailNavigation method;
[0052] The didStartProvisionalNavigation method is called when the page starts loading;
[0053] The didFailProvisionalNavigation method is called when a new navigation has failed before starting;
[0054] The didFinishNavigation method is called when the page loading is completed;
[0055] The didFailNavigation method is called when navigation fails.
[0056] In an embodiment of the present application, the view component used may be WKWebView or UIWebView. Before implementing the definition of the global white screen marker and the page status marker, the method also includes at least one target method for WKWebView or UIWebView to achieve the target requirements. These methods are used to implement the standard proxy protocol corresponding to WKWebView or UIWebView. Specifically, these methods include didStartProvisionalNavigation method, didFailProvisionalNavigation method, didFinishNavigation method, and didFailNavigation method.
[0057] Among them, the didStartProvisionalNavigation method is called when the page starts to load, and it can be used to record the start time of page loading and related loading information; the didFailProvisionalNavigation method is called when a new navigation has failed before starting, and it can be used to capture error information before navigation fails; the didFinishNavigation method is called when the page loading is completed, and is used to record the time and status of page loading completion; the didFailNavigation method is called when navigation fails, and is used to capture relevant information about navigation failure.
[0058] The realization of these target methods enables the method to accurately capture the white screen phenomenon during page loading, and combined with the use of global white screen markers and page status markers, it can achieve comprehensive monitoring and recording of white screen events. This provides important data and basis for subsequent analysis and resolution of white screen problems.
[0059] In some embodiments, see Figure 2 , Figure 2 It is a flow chart of steps S201-S202 provided in an embodiment of the present application, in response to an access request for a target link, loading the view component, monitoring the target page based on the view component, and modifying the page status mark corresponding to the target page based on the monitoring result. This can be achieved through steps S201-S202, which will be explained in conjunction with each step.
[0060] In step S201, in response to the triggering of the didStartProvisionalNavigation method, the current timestamp and the target link are recorded, and the page status mark is set to NO, wherein the page status mark being NO indicates a white screen state.
[0061] In step S202, in response to the triggering of the didFailProvisionalNavigation method or the didFailProvisionalNavigation method or the didFinishNavigation method, the page status mark is modified to YES, wherein the page status mark of YES indicates a normal state.
[0062] Here, when the didStartProvisionalNavigation method is triggered, the system will record the current timestamp and target link. At this time, the page status mark will be set to NO, indicating that the page is in a white screen state. This design helps to initially mark the page in a white screen state when it starts loading.
[0063] Then, no matter the didFailProvisionalNavigation method, didFailNavigation method, or didFinishNavigation method is triggered, the system will change the page status flag to YES. This operation indicates that the page has left the white screen state and entered the normal state. In this way, the system can track the state changes of the page in real time and accurately.
[0064] The above method, by responding to different method triggers, accurately captures the state changes of the page, especially the transition from the white screen state to the normal state, providing an accurate data basis for subsequent white screen problem processing.
[0065] In some embodiments, see Figure 3 , Figure 3 It is a flowchart of steps S301-S302 provided in an embodiment of the present application. The method also includes steps S301-S302, which will be described in combination with each step.
[0066] In step S301, a target listener is established, wherein the target listener is used to monitor page click switching events.
[0067] In step S302, in response to a click-to-switch operation on a secondary page, the page state of the secondary page is monitored by the listener.
[0068] The listener here is specifically used to listen for page click switching events. With such a listener, the method can be extended to track the user's interaction with the page, not just the state of the page during loading. This means that when the user clicks and switches to another secondary page, the listener will start and monitor the state of this new page. In this way, whether it is entering a secondary page from a primary page or switching between different secondary pages, this method can accurately track and record the state of the page.
[0069] Specifically, because the webview of the tab page will not be deallocated after the first load, it is necessary to trigger the detection of a white screen when the page is displayed or hidden. Therefore, we need to use the iOS notification mechanism, so we register a tab page click switch listener here to simulate the dealloc operation of a normal secondary page.
[0070] This extension enhances the completeness of the method, enabling it to more comprehensively capture and record white screen situations, providing a more robust monitoring mechanism for applications.
[0071] In some embodiments, see Figure 4 , Figure 4 It is a flow chart of steps S401-S402 provided in an embodiment of the present application, wherein the page status mark quantity is verified and processed, the white screen information whose verification result is a white screen is obtained, and the white screen page information is added to the global white screen mark quantity. This can be achieved through steps S401-S402, which will be explained in combination with each step.
[0072] In step S401, when the page status mark is NO, the white screen information corresponding to the page is obtained.
[0073] In step S402, the white screen information is written into the global white screen mark, and the number of times the white screen is generated is increased by one.
[0074] Specifically, when the page status mark is NO, it means that the page is in a white screen state. At this time, the system will obtain the white screen information corresponding to the page. This information may include the time when the white screen occurred, the duration, the device model, the operating system version, etc., which is used for subsequent analysis and problem location.
[0075] After obtaining the white screen information, the system will write it to the global white screen marker. The global white screen marker is a data structure that records all white screen events. It stores the relevant information of each white screen. Writing the white screen information to the global marker helps to uniformly manage and analyze all white screen events.
[0076] In addition, the system will add 1 to the number of white screens. This counting operation can count the total number of white screens that appear in the application, further helping developers understand the severity and frequency of white screen issues.
[0077] The above method can capture white screen events in real time by verifying the page status mark, and store the relevant information in the global white screen mark, providing strong support for subsequent troubleshooting and performance optimization.
[0078] In some embodiments, see Figure 5 , Figure 5 It is a flow chart of steps S501-S502 provided in an embodiment of the present application. Before obtaining the white screen information corresponding to the page, the method can also execute steps S501-S502, which will be explained in combination with each step.
[0079] In step S501, the difference between the current time and the timestamp is calculated;
[0080] In step S502, if the difference is less than a preset time threshold, the collection of the white screen information is discarded.
[0081] Here, the system calculates the difference between the current time and the previously recorded timestamp. This difference represents the time that has passed since the page started loading.
[0082] Next, the system will compare this difference with a preset time threshold. If the difference is less than the preset time threshold (usually set to 3 seconds), it means that the page loading time is too short and it may not be a true white screen event (for example, the user quickly enters and exits, resulting in no callback data update in time). Therefore, the system will exclude the collection of this white screen information to prevent false alarms and unnecessary processing.
[0083] In this way, the system can filter out those short-term "white screen" events that do not meet the preset conditions, thereby ensuring that the collected white screen information is valid and accurate. This also reduces the additional processing overhead caused by false alarms and improves the efficiency and accuracy of the entire white screen monitoring method.
[0084] In some embodiments, the method further comprises:
[0085] When a white screen is generated, a prompt message is displayed through the human-computer interaction interface to prompt the user that there is an abnormality in the current view component, and the prompt message prompts the user to restart the current application.
[0086] Here, when the system detects the white screen phenomenon and confirms that it is a real white screen event, it will display a prompt message through the human-computer interaction interface. This is done to inform the user that the current view component has an abnormality, that is, the white screen phenomenon.
[0087] In addition, the prompt message will also suggest that the user restart the current application. This design is to try to solve the white screen problem that may be caused by temporary errors or resource conflicts. By restarting the application, many temporary problems may be solved, allowing users to continue using the application.
[0088] This user prompt mechanism can not only enhance the user's right to know and let users understand the current status of the application, but also provide some basic solution strategies to improve the smoothness and satisfaction of users during use.
[0089] In summary, the embodiments of the present application have the following beneficial effects:
[0090] By defining the global white screen marker, each white screen phenomenon and its occurrence frequency in the application can be recorded, thus providing a comprehensive perspective to detect white screen problems and ensuring that nothing is missed. It can not only comprehensively record the white screen phenomenon and its frequency in the application, but also monitor the page status in real time to ensure a quick response to white screen events. This method makes full use of the characteristics of the webview proxy method on the iOS side to fully cover and collect special white screens under WKWebView and UIWebView, without intruding on the business code. It only performs some seemingly routine but "killing" precise capture in the core logic of the webview, which provides strong data support for the accurate positioning of the number of white screens and the severity of online business, and provides good log records for further solving such problems in the future.
[0091] Based on the same inventive concept, the embodiment of the present application also provides a white screen monitoring device based on a view component corresponding to the white screen monitoring method based on a view component in the first embodiment. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned white screen monitoring method based on a view component, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0092] like Figure 6 As shown, Figure 6 : is a structural diagram of a white screen monitoring device 600 based on a view component provided in an embodiment of the present application. The white screen monitoring device 600 based on a view component includes:
[0093] A definition module 601 is used to define a global white screen mark and a page status mark, wherein the global white screen mark is used to record the white screen information generated each time and the number of times the white screen is generated, and the page status mark is used to indicate whether the page status is a white screen;
[0094] A monitoring module 602 is used to load the view component in response to an access request for a target link, perform monitoring processing on the target page based on the view component, and modify the page status mark corresponding to the target page based on the monitoring result;
[0095] The acquisition module 603 is used to verify the page status mark in response to the page destruction operation, obtain the white screen information of which the verification result is a white screen, and accumulate the white screen page information to the global white screen mark;
[0096] The reporting module 604 is configured to report the white screen information generated each time a white screen occurs in the global white screen mark quantity in response to the global white screen mark quantity satisfying a preset reporting condition.
[0097] Those skilled in the art should understand that Figure 6 The implementation functions of each unit in the white screen monitoring device 600 based on the view component shown can be understood by referring to the relevant description of the white screen monitoring method based on the view component mentioned above. Figure 6 The functions of the various units in the white screen monitoring device 600 based on the view component shown can be implemented by a program running on a processor, or can be implemented by a specific logic circuit.
[0098] In a possible implementation, the view component is WKWebView or UIWebView, and before the definition module 601 defines the global white screen mark amount and the page status mark amount, it also includes:
[0099] For WKWebView or UIWebView, implement at least one target method under the target requirement to implement the standard proxy protocol corresponding to WKWebView or UIWebView. The at least one target method includes the following methods:
[0100] didStartProvisionalNavigation method, didFailProvisionalNavigation, didFinishNavigation method, didFailNavigation method;
[0101] The didStartProvisionalNavigation method is called when the page starts loading;
[0102] The didFailProvisionalNavigation method is called when a new navigation has failed before starting;
[0103] The didFinishNavigation method is called when the page loading is completed;
[0104] The didFailNavigation method is called when navigation fails.
[0105] In a possible implementation, the monitoring module 602 loads the view component in response to an access request for a target link, performs monitoring processing on the target page based on the view component, and modifies the page status mark corresponding to the target page based on the monitoring result, including:
[0106] In response to the triggering of the didStartProvisionalNavigation method, the current timestamp and the target link are recorded, and the page status mark is set to NO, wherein the page status mark being NO indicates a white screen state;
[0107] In response to the triggering of the didFailProvisionalNavigation method or the didFailProvisionalNavigation method or the didFinishNavigation method, the page status mark is modified to YES, wherein the page status mark being YES indicates a normal state.
[0108] In a possible implementation, the monitoring module 602 further includes:
[0109] Establishing a target listener, wherein the target listener is used to monitor page click switching events;
[0110] In response to a click-to-switch operation on a secondary page, the page state of the secondary page is monitored by the listener.
[0111] In a possible implementation, the acquisition module 603 performs verification processing on the page status mark, obtains the white screen information whose verification result is a white screen, and accumulates the white screen page information to the global white screen mark, including:
[0112] When the page status mark is NO, obtaining the white screen information corresponding to the page;
[0113] The white screen information is written into the global white screen mark, and the number of times the white screen is generated is increased by one.
[0114] In a possible implementation, before the acquisition module 603 acquires the white screen information corresponding to the page, the method further includes:
[0115] Calculate the difference between the current time and the timestamp;
[0116] If the difference is less than the preset time threshold, the collection of the white screen information is discarded.
[0117] In a possible implementation, the reporting module 604 further includes:
[0118] When a white screen is generated, a prompt message is displayed through the human-computer interaction interface to prompt the user that there is an abnormality in the current view component, and the prompt message prompts the user to restart the current application.
[0119] The above-mentioned white screen monitoring device based on the view component can record each white screen phenomenon and its occurrence frequency in the application by defining the global white screen marker, thereby providing a comprehensive perspective to detect white screen problems and ensure that nothing is missed. It can not only comprehensively record the white screen phenomenon and its frequency in the application, but also monitor the page status in real time to ensure a quick response to white screen events. This method makes full use of the characteristics of the webview proxy method on the iOS side to fully cover and collect the special white screens under WKWebView and UIWebView, without intruding on the business code. It only performs some seemingly routine but "killing" precise capture at the core logic of the webview, which provides strong data support for the accurate positioning of the number of white screens and the severity of online business, and provides good log records for further solving such problems in the future.
[0120] like Figure 7 As shown, Figure 7 The present invention provides a schematic diagram of the structure of an electronic device 700, wherein the electronic device 700 includes:
[0121] A processor 701, a storage medium 702 and a bus 703, wherein the storage medium 702 stores machine-readable instructions executable by the processor 701. When the electronic device 700 is running, the processor 701 communicates with the storage medium 702 via the bus 703, and the processor 701 executes the machine-readable instructions to perform the steps of the white screen monitoring method based on the view component described in the embodiment of the present application.
[0122] In actual application, the components in the electronic device 700 are coupled together via the bus 703. It is understood that the bus 703 is used to realize the connection and communication between these components. In addition to the data bus, the bus 703 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 7 Various buses are labeled as bus 703.
[0123] By defining a global white screen marker, the electronic device can record each white screen phenomenon and the number of times it occurs within the application, thereby providing a comprehensive perspective to detect white screen problems and ensure that nothing is missed. It can not only comprehensively record the white screen phenomenon and the number of times within the application, but also monitor the page status in real time to ensure a quick response to white screen events. This method makes full use of the characteristics of the webview proxy method on the iOS side to fully cover and collect special white screens under WKWebView and UIWebView, without intruding on the business code. It only performs some seemingly routine but "killing" precise capture at the core logic of the webview, which provides strong data support for the accurate positioning of the number of white screens and the severity of online business, and provides good log records for further solving such problems in the future.
[0124] The embodiment of the present application also provides a computer-readable storage medium, which stores executable instructions. When the executable instructions are executed by at least one processor 701, the white screen monitoring method based on the view component described in the embodiment of the present application is implemented.
[0125] In some embodiments, the storage medium can be a magnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface storage, an optical disk, or a compact disc read-only memory (CD ROM); it can also be various devices including one or any combination of the above memories.
[0126] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0127] As an example, executable instructions may, but do not necessarily, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (for example, files storing one or more modules, subroutines, or code portions).
[0128] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0129] The computer-readable storage medium can record each white screen phenomenon and its occurrence frequency within the application by defining a global white screen marker, thereby providing a comprehensive perspective to detect white screen problems and ensure that nothing is missed. It can not only comprehensively record the white screen phenomenon and its frequency within the application, but also monitor the page status in real time to ensure a quick response to white screen events. This method makes full use of the characteristics of the webview proxy method on the iOS side to fully cover and collect special white screens under WKWebView and UIWebView, without intruding on the business code. It only performs some seemingly routine but "killing" precise capture at the core logic of the webview, which provides strong data support for the accurate positioning of the number of white screens and the severity of online business, and provides good log records for further solving such problems in the future.
[0130] In the several embodiments provided in the present application, it should be understood that the disclosed methods and electronic devices can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0131] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0132] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0133] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a platform server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0134] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A white screen monitoring method based on view components, characterized in that: The method comprises: Define a global white screen mark and a page status mark, wherein the global white screen mark is used to record the white screen information generated each time and the number of times the white screen is generated, and the page status mark is used to indicate whether the page status is a white screen; In response to an access request for a target link, the view component is loaded, a target page is monitored based on the view component, and the page status mark corresponding to the target page is modified based on the monitoring result; In response to the page destruction operation, the page status mark quantity is verified, the white screen information of which the verification result is a white screen is obtained, and the white screen page information is accumulated to the global white screen mark quantity; In response to the global white screen mark quantity satisfying a preset reporting condition, the white screen information generated each time a white screen occurs in the global white screen mark quantity is reported.
2. The method according to claim 1, characterized in that The view component is WKWebView or UIWebView. Before defining the global white screen mark and the page status mark, the method further includes: For WKWebView or UIWebView, implement at least one target method under the target requirement to implement the standard proxy protocol corresponding to WKWebView or UIWebView. The at least one target method includes the following methods: didStartProvisionalNavigation method, didFailProvisionalNavigation, didFinishNavigation method, didFailNavigation method; The didStartProvisionalNavigation method is called when the page starts loading; The didFailProvisionalNavigation method is called when a new navigation has failed before starting; The didFinishNavigation method is called when the page loading is completed; The didFailNavigation method is called when navigation fails.
3. The method according to claim 2, characterized in that The step of loading the view component in response to the access request for the target link, performing monitoring processing on the target page based on the view component, and modifying the page status mark corresponding to the target page based on the monitoring result includes: In response to the triggering of the didStartProvisionalNavigation method, the current timestamp and the target link are recorded, and the page status mark is set to NO, wherein the page status mark being NO indicates a white screen state; In response to the triggering of the didFailProvisionalNavigation method or the didFailProvisionalNavigation method or the didFinishNavigation method, the page status mark is modified to YES, wherein the page status mark being YES indicates a normal state.
4. The method according to claim 3, characterized in that The method further comprises: Establishing a target listener, wherein the target listener is used to monitor page click switching events; In response to a click-to-switch operation on a secondary page, the page state of the secondary page is monitored by the listener.
5. The method according to claim 3, characterized in that: The verifying the page status mark, obtaining the white screen information of which the verification result is a white screen, and accumulating the white screen page information to the global white screen mark, includes: When the page status mark is NO, obtaining the white screen information corresponding to the page; The white screen information is written into the global white screen mark, and the number of times the white screen is generated is increased by one.
6. The method according to claim 5, characterized in that Before obtaining the white screen information corresponding to the page, the method further includes: Calculate the difference between the current time and the timestamp; If the difference is less than the preset time threshold, the collection of the white screen information is discarded.
7. The method according to claim 1, further comprising: When a white screen is generated, a prompt message is displayed through the human-computer interaction interface to prompt the user that there is an abnormality in the current view component, and the prompt message prompts the user to restart the current application.
8. A white screen monitoring device based on a view component, characterized in that: The device comprises: A definition module is used to define a global white screen mark and a page status mark, wherein the global white screen mark is used to record the white screen information generated each time and the number of times the white screen is generated, and the page status mark is used to indicate whether the page status is a white screen; A monitoring module, for responding to an access request for a target link, loading the view component, performing monitoring processing on the target page based on the view component, and modifying the page status mark corresponding to the target page based on the monitoring result; an acquisition module, configured to, in response to a page destruction operation, perform verification processing on the page status mark quantity, obtain the white screen information of which the verification result is a white screen, and accumulate the white screen page information to the global white screen mark quantity; The reporting module is used to report the white screen information generated each time a white screen occurs in the global white screen mark quantity in response to the global white screen mark quantity satisfying a preset reporting condition.
9. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to execute the white screen monitoring method based on the view component as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the white screen monitoring method based on the view component according to any one of claims 1 to 7 is executed.
