CN109284217B - Application program exception handling method and device, electronic equipment and storage medium - Google Patents

Application program exception handling method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN109284217B
CN109284217B CN201811142667.XA CN201811142667A CN109284217B CN 109284217 B CN109284217 B CN 109284217B CN 201811142667 A CN201811142667 A CN 201811142667A CN 109284217 B CN109284217 B CN 109284217B
Authority
CN
China
Prior art keywords
application program
interface
application
preset
preprocessing function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811142667.XA
Other languages
Chinese (zh)
Other versions
CN109284217A (en
Inventor
廖伟杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811142667.XA priority Critical patent/CN109284217B/en
Publication of CN109284217A publication Critical patent/CN109284217A/en
Application granted granted Critical
Publication of CN109284217B publication Critical patent/CN109284217B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available

Abstract

The method can capture abnormal running state information when an application program is abnormal, call a preprocessing function to replace the abnormal information, analyze the abnormal running state information when the application program is abnormal, and count the times of calling the preprocessing function, thereby facilitating the counting of the times of the application program abnormality. No matter what reason the application program is flashed off, abnormal information causing the flashing off is captured by monitoring system data through a software monitoring method, and then the abnormal information is replaced, so that the application program does not be flashed off when abnormal occurs, corresponding operation is executed, and user experience is improved. The invention also provides an application program exception handling device, electronic equipment and a storage medium.

Description

Application program exception handling method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of mobile communication, in particular to an application program exception handling method and device, electronic equipment and a storage medium.
Background
At present, in an intelligent electronic device, the number of applications installed by a user is increasing, the sources of the applications are different, and the stability of the applications is also different. For many ios applications, there is an inevitable occurrence of crash (flash back), and no matter how perfect the developer writes the program, the occurrence of crash cannot be completely avoided, so that there are various causes for the occurrence of crash in the application. For example, if the APP has an exception in the program design, a user may have a phenomenon of crash flash back due to an abnormal operation of the APP in the process of using the APP, so that the APP cannot be normally used, and user experience is affected.
In the prior art, due to the complexity of the use environment and the use scene of the electronic device, exception handling of an application program cannot be completely covered, and the situation that crash occurs to the application program in the electronic device is common. The application program is processed by the application program after the crash occurs, and the application program is automatically processed in a mode of flashing back or stopping running the application program when the abnormality occurs, so that the user experience is influenced.
Disclosure of Invention
In view of the foregoing, there is a need for an application exception handling method, apparatus, electronic device, and storage medium, which can capture information about an abnormal operation state of an application when an exception occurs, and call a preprocessing function to replace an exception message.
A first aspect of the present invention provides an application exception handling method, including:
monitoring the running state of an application program in the electronic equipment;
when the application program is monitored to be abnormal in operation, calling a preprocessing function, wherein the preprocessing function comprises displaying a preset interface; and
and displaying the preset interface according to the preprocessing function.
Preferably, the step of monitoring the running state of the application program in the electronic device comprises:
acquiring configuration information of software and hardware called when an application program runs in the electronic equipment;
monitoring the calling condition of function calling software and hardware configured in the application program and the running condition of the software and the hardware running according to the function according to the configuration information of the software and the hardware; and
and monitoring and analyzing the application program according to the calling condition and the running condition.
Preferably, the preset interface includes a blank interface, an interface of a preset application program, and a main interface of the electronic device.
Preferably, when it is monitored that the application program operates abnormally, the method further includes:
acquiring the latest cache information of the application program;
and acquiring abnormal running state information of the application program by inquiring the latest cache information, wherein the abnormal running state information comprises array script boundary crossing, null pointer abnormity and class conversion abnormity.
Preferably, after obtaining the latest cache information of the application program, the method further includes:
skipping to a page when the application program is abnormal according to the latest cache information; and
and restoring the operation data on the page when the application program is abnormal.
Preferably, when it is monitored that the application program operates abnormally, after the preprocessing function is called, the method further includes: counting the number of times the preprocessing function is called,
judging whether the number of times of calling the preprocessing function in the preset time reaches the preset number of times or not;
restarting the application program when the number of times of calling the preprocessing function in the preset time reaches a preset number of times, wherein before restarting the application program, the application program further comprises clearing cache data of the application program;
and when the times of calling the preprocessing function in the preset time do not reach the preset times, continuously judging whether the times of calling the preprocessing function in the preset time reach the preset times or not.
Preferably, the preprocessing function further comprises downloading and reinstalling the application and upgrading the application.
A second aspect of the present invention provides an application exception handling apparatus, the apparatus comprising:
the monitoring module is used for monitoring the running state of an application program in the electronic equipment;
the calling module is used for calling a preprocessing function when the abnormal operation of the application program is monitored, wherein the preprocessing function comprises a preset interface; and
and the processing module is used for displaying the preset interface according to the preprocessing function.
A third aspect of the present invention provides an electronic device, which includes a processor and a memory, wherein the processor is configured to implement the application exception handling method when executing a computer program stored in the memory.
A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the application exception handling method.
The method can capture the abnormal operation state information when the application program is abnormal, call the preprocessing function to replace the abnormal information, analyze the abnormal operation state information when the application program is abnormal, and count the times of calling the preprocessing function, thereby conveniently counting the times of the application program abnormality. No matter what reason the application program is flashed off, as long as the exception causing the flashing off can be captured, the exception is replaced, so that the application program does not flash off when the exception occurs, corresponding operation is executed, and user experience is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of an application exception handling method according to an embodiment of the present invention.
Fig. 2 is a functional block diagram of an application exception handling apparatus according to a second embodiment of the present invention.
Fig. 3 is a schematic diagram of an electronic device according to a third embodiment of the present invention.
The following detailed description will further illustrate the invention in conjunction with the above-described figures.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a detailed description of the present invention will be given below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and features of the embodiments may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, and the described embodiments are merely some, but not all embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
The terms "first," "second," and "third," etc. in the description and claims of the present invention and the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprises" and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
The application program exception handling method provided by the embodiment of the invention is applied to one or more electronic devices. The application program exception handling method can also be applied to a hardware environment formed by an electronic device and a server connected with the electronic device through a network. Networks include, but are not limited to: a wide area network, a metropolitan area network, or a local area network. The application program exception handling method can be executed by a server or an electronic device; or may be performed by both the server and the electronic device.
For the electronic device which needs to perform the application exception handling method, the application exception handling function provided by the method of the present invention may be directly integrated on the electronic device, or a client for implementing the method of the present invention may be installed. For another example, the method provided by the present invention may also be run on a device such as a server in the form of a Software Development Kit (SDK), an interface of the application exception handling function is provided in the form of the SDK, and the electronic device or other devices may implement processing of the exception application through the provided interface.
Example one
Fig. 1 is a flowchart of an application exception handling method according to an embodiment of the present invention. The execution order in the flow chart can be changed and some steps can be omitted according to different requirements.
S11, monitoring the running state of the application program in the electronic equipment.
In this embodiment, the application may be an application of the electronic device, such as a phone call, a short message, a setting, a camera, a photo, a mail, a memo, a music player, a video player, a calendar, weather, and the like; the method can also be any third-party application installed in an operating system of the electronic equipment, such as WeChat, microblog, aiqiyi, youkou, health 160, jingdong, baidu sticky rice, baidu map, cool dog music, yinyun music, mobile phone Taobao and other applications. The application may also be a web application (webApp) for a browser on an electronic device, such as phonegap or the like. The present embodiment is not limited to this.
The operating system comprises Android and ios at present.
In this embodiment, cocoapods are used as the third-party library for the application program in this embodiment. Any application can implement the relevant functions by using this third party library.
The electronic device may include, but is not limited to, a Personal Computer (PC), a Personal Digital Assistant (PDA), a wireless handheld device, a Tablet Computer (Tablet Computer), a mobile phone, an MP3 player, an MP4 player, and the like.
Preferably, the running state of the application program comprises normal running of the application program and abnormal running of the application program.
The normal running of the application includes that the application is not started yet (not running), the application is running in the foreground but does not receive an event (Inactive), the application is running in the foreground and receives an event (active), the application is running in the background and executing code (background), and the application is running in the background but stops executing code (suspended).
The application is running in the foreground but does not receive events, generally meaning that each time the application is to switch from one state to a different state, the transition will briefly stay in this Inactive state. The case where the dwell time is relatively long in the Inactive state is: when the user locks the screen, or when the system prompts the user to respond to certain events (such as incoming phone calls, unread messages, etc.). The background state is that the system automatically moves the application into the background state, and no notification is given to the application until the background state is reached. When the application is in this state, the application still resides in memory but does not execute any program code. When the system generates a low memory alarm, the system will clear the application in the Suspended state out of the memory, thereby providing enough memory for the application running in the foreground.
The reason for the running exception of the application may be the crash (crash) of the application. The application program running exception comprises an exception (exception) and an error (error).
The error represents a serious problem that the application itself cannot overcome and recover. Such as memory overflow and thread deadlock.
The exception represents a problem that the application can overcome and recover, and is divided into a system exception and a common exception.
The system exception is a problem caused by defects of the application program, namely the problem caused by the fact that a developer cannot consider the problem, and a user cannot overcome and recover the problem. For example, an array script is out of bounds (ArrayIndexOutOfBoundsException), null pointer exception (NullPointerException), class transition exception (ClassCastException), and the like.
The general abnormality is a problem caused by a change in the operating environment or an abnormality, and is a problem that a user can overcome. For example, the network is disconnected, the hard disk space is not enough, etc.
In this embodiment, the running state of each application program in the electronic device may be acquired through the system activity management module, and the running states of all the application programs are monitored in real time.
Specifically, the step of monitoring the running states of all the application programs in real time through the system activity management module comprises the following steps:
the system activity management module acquires configuration information of software and hardware called when an application program runs in the electronic equipment;
the system activity management module monitors the calling condition of the function calling software and the hardware configured in the application program and the running condition of the software and the hardware running according to the function according to the configuration information of the software and the hardware; and
the system activity management module monitors and analyzes the application program according to the calling condition of the function to the software and the hardware and the running condition of the software and the hardware according to the function operation.
And S12, calling a preprocessing function when the abnormal operation of the application program is monitored, wherein the preprocessing function is used for displaying a preset interface.
For example, in the iOS system, the exception information may be intercepted by a message forwarding function of the hook iOS system, and then the exception may be handled by inserting a customized service processing logic, such as the above-mentioned pre-processing function.
Specifically, the AOP framework Aspects is adopted in the iOS system to implement exception handling. For example, when a message is sent to an object, when the method is not found in the class inheritance system of the object, a Crash (blast) occurs, and the exception information of ". Unrequired selected sent to 8230;" is thrown, but the following methods are sequentially executed before the exception is thrown:
(1) resollveinstancemethod (or resollveclassvhod): the method can be realized by a class _ addMethod adding method, if YES is returned, the system restarts a message sending process when running, and if NO, the next method is continuously executed;
(2) forward targetselector: the method can be realized by forwarding the message to other objects, and as long as the returned message is not nil or self, the method can restart the process of sending the message and forward the message to other objects for processing;
(3) method signatureforeselector: the method obtains a method signature, if the method signature is not obtained, the method directly calls a dosenscognizaeselector, if the method signature can be obtained, the system creates an NSlnvocation and sends the NSlnvocation to a forwardInvocation method;
(4) forwardlnvocation: the method is that the previous method transmits the incoming NSlnvocation, then calls the invokeWithTarget method of the NSlnvocation, and transmits the NSlnvocation to the corresponding Target;
(5) dosnotrecognizieselector: an unorganized selector sent to 82303030is thrown.
As known from the above message forwarding methods, aspects mainly utilize forwardlnvocation for forwarding, and Aspects dynamically creates a subclass to point a corresponding object isa pointer to the created subclass, and then replaces IMP of forwardlnvocation of the subclass with _ ASPECTS _ ARE _ BEING _ CALLED _. Assuming that the name of the method to be book is XX, adding a method of Aspects _ XX in the subclass, then pointing IMP of Aspects _ XX to IMP of the original XX method, so as to conveniently call the original method later, and pointing IMP of method to be book XX to _ obj _ msgForward, so as to enter a message forwarding flow, and the IMP of forwarddInvocation is replaced by _ ASPECTS _ ARE _ BEING _ CALLID _, so as to enter into _ ASPECTS _ ARE _ BEING _ CALLID _forinterception exception processing, and then calling the preprocessing function after the interception processing.
In other embodiments, the method may further recover the application program according to the obtained abnormal operation state information, specifically including:
a) And when the abnormal operation of the application program is detected, acquiring the latest cache information of the application program.
Specifically, the latest cache of the application program is inquired by calling the system package manager, and the latest cache of the application program comprises cache information when crash of the application program occurs.
In other embodiments, a breakpoint tool may be integrated into an application program, and when the application program runs abnormally, the breakpoint tool is used to capture abnormal running state information of the application program. The abnormal operation state information comprises array script boundary crossing, null pointer abnormity, class conversion abnormity and the like.
b) And recovering the application program according to the latest cache information.
Specifically, the application program is started, the page is jumped to when the crash happens according to the latest cache information, and the operation data on the page is restored. For example, the hot repair code is downloaded and loaded, and the hot repair code may be downloaded in the application didfinishslaunchwithoptions method, such as JavaScript patch (JSPatch) or WaxPatch. In addition, in order to ensure that the repair of the code of the application program can be completed and the time for downloading and loading the hot repair code is ensured, a prompt box can be popped up, for example, a user is prompted to repair the application program.
And S13, displaying the preset interface according to the preprocessing function.
In this embodiment, the preprocessing function is to display a preset interface. The preset interface can be a blank interface, an interface of a preset application program and a main interface of the electronic equipment.
Specifically, when the preprocessing function is to display a blank interface, displaying the current interface of the application program as the blank interface, thereby avoiding the application program from being flashed back; when the preprocessing function is to display a preset application program interface (such as a music player), starting the preset application program and displaying the preset application program interface, so that a user can be guided to execute other application programs to relieve the emotion of the user; when the preprocessing function is to display a main interface of the electronic equipment, returning to the main interface of the electronic equipment from the current interface of the application program;
in other embodiments, the corresponding operation may be executed according to the preprocessing function, where the preprocessing function includes downloading and reinstalling an application program and upgrading the application program.
Specifically, when the preprocessing function is to download and reinstall the application program, the corresponding operation is to download and reinstall the application program; and when the preprocessing function is used for upgrading the application program, the corresponding operation is used for upgrading the application program. Since the preprocessing functions and their corresponding operations are various, they are not listed here.
In this embodiment, after displaying the preset interface according to the preprocessing function, the method further includes: and counting the times of calling the preprocessing function, wherein the times of crashing the application program can be obtained by counting the times of calling the preprocessing function.
In this embodiment, after counting the number of times of calling the preprocessing function, the method further includes: and judging whether the times of calling the preprocessing function in the preset time reach the preset times or not.
When the number of times of calling the preprocessing function in the preset time reaches the preset number of times, the application program is restarted or the application program is restarted after the cache data of the application program is removed, and the process of removing the cache data and restarting can solve the problem that some applications still crash after being restarted.
And when the times of calling the preprocessing function in the preset time do not reach the preset times, continuously judging whether the times of calling the preprocessing function in the preset time reach the preset times or not.
In this embodiment, the preset time may be one minute, and the preset number of times may be three times.
In summary, the application exception handling method provided by the present invention monitors the running states of all applications running in the electronic device through the bottom layer, and when it is monitored that the running state of an application is an abnormal running state, captures abnormal running state information when the application is abnormal, and calls a preprocessing function to replace the abnormal message, and meanwhile, can analyze the abnormal running state information when the application is abnormal, and count the number of times of calling the preprocessing function, thereby facilitating the counting of the number of times of the application abnormality. No matter what reason the application program is flashed off, as long as the exception causing the flashing off can be captured, the exception is replaced, so that the application program does not flash off when the exception occurs, corresponding operation is executed, and user experience is improved.
While the invention has been described with reference to specific embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.
The following describes functional modules and hardware structures of an electronic device implementing the application exception handling method described above with reference to fig. 2 to 3, respectively.
Example two
FIG. 2 is a functional block diagram of an application exception handling apparatus according to a preferred embodiment of the present invention.
In some embodiments, the application exception handling apparatus 20 is run in an electronic device. The application exception handling apparatus 20 may comprise a plurality of functional modules comprised of program code segments. The program code of each program segment in the application exception handling apparatus 20 may be stored in the memory and executed by the at least one processor to perform the anti-theft function (see fig. 1 and the related description).
In this embodiment, the application exception handling apparatus 20 may be divided into a plurality of functional modules according to the functions to be executed by the apparatus. The functional module may include: a monitoring module 201, a calling module 202 and a processing module 203. The module referred to herein is a series of computer program segments capable of being executed by at least one processor and capable of performing a fixed function and is stored in memory. In some embodiments, the functionality of the various modules will be described in greater detail in subsequent embodiments.
The monitoring module 201 is configured to monitor an operating state of an application program in the electronic device.
In this embodiment, the application program may be an application program of the electronic device, such as a phone, a short message, a setting, a camera, a photo, a mail, a memo, a music player, a video player, a calendar, weather, and the like; the method can also be any third-party application installed in an operating system of the electronic equipment, such as WeChat, microblog, aiqiyi, youkou, health 160, jingdong, baidu sticky rice, baidu map, cool dog music, yinyun music, mobile phone Taobao and other applications. The application may also be a web application (webApp) of a browser on the electronic device, such as phonegap or the like. The present embodiment is not limited to this.
The operating system comprises Android and ios only at present.
In this embodiment, coco appods are used as the third-party library for the application program in this embodiment. Any application can implement the relevant functionality by using this third party library.
The electronic device may include, but is not limited to, a Personal Computer (PC), a Personal Digital Assistant (PDA), a wireless handheld device, a Tablet Computer (Tablet Computer), a mobile phone, an MP3 player, an MP4 player, and the like.
Preferably, the running state of the application program comprises normal running of the application program and abnormal running of the application program.
The normal running of the application includes that the application is not started yet (not running), the application is running in the foreground but does not receive an event (Inactive), the application is running in the foreground and receives an event (active), the application is running in the background and executing code (background), and the application is running in the background but stops executing code (suspended).
The application is running in the foreground but does not receive events, generally meaning that each time the application is to switch from one state to a different state, the transition will briefly stay in this Inactive state. The case where the dwell time is relatively long in the Inactive state is: when the user locks the screen, or when the system prompts the user to respond to certain events (such as incoming phone calls, unread messages, etc.). The background state means that the system automatically moves the application program into the background state, and no notification is made to the application program before the background state. When the application is in this state, the application still resides in memory but does not execute any program code. When the system has a low memory alarm, the system will clear the application in Suspended state out of the memory, thereby providing enough memory for the application running in the foreground.
The cause of the abnormal operation of the application program may be the occurrence of crash (crash) of the application program. The application running exception comprises an exception (exception) and an error (error).
The error represents a serious problem that the application itself cannot overcome and recover. Such as memory overflow and thread deadlock.
The exception represents a problem that the application can overcome and recover, and is divided into a system exception and a common exception.
The system exception is a problem caused by defects of the application program, namely the problem caused by the fact that a developer cannot consider the problem, and a user cannot overcome and recover the problem. For example, array script out of bounds (ArrayIndexOutOfBoundsException), null pointer exception (NullPointerException), class transition exception (ClassCastException), and the like.
The general abnormality is a problem caused by a change in the operating environment or an abnormality, and is a problem that a user can overcome. For example, the network is disconnected, the hard disk space is not enough, etc.
In this embodiment, the running state of each application program in the electronic device may be acquired through the system activity management module, and the running states of all the application programs are monitored in real time.
Specifically, the real-time monitoring of the running states of all the application programs by the system activity management module comprises the following steps:
the system activity management module acquires configuration information of software and hardware called when an application program runs in the electronic equipment;
the system activity management module monitors the calling condition of the function calling software and the hardware configured in the application program and the running condition of the software and the hardware running according to the function according to the configuration information of the software and the hardware; and
the system activity management module monitors and analyzes the application program according to the calling condition of the function to the software and the hardware and the running condition of the software and the hardware according to the running of the function.
The calling module 202 is configured to call a preprocessing function when it is monitored that the application program is abnormal in operation, where the preprocessing function is to display a preset interface.
For example, in the iOS system, the exception information may be intercepted by a message forwarding function of the hook iOS system, and then the exception may be handled by inserting a customized service processing logic, such as the above-mentioned preprocessing function.
Specifically, the AOP framework Aspects is adopted in the iOS system to implement exception handling. For example, when a message is sent to an object, when the method is not found in the class inheritance system of the object, a Crash (blast) occurs, and the exception information of ". Unrequired selected sent to 8230;" is thrown, but the following methods are sequentially executed before the exception is thrown:
(1) resolveInstanceMethod (or resolveclassvold method): the method can be realized by a class _ addMethod adding method, if YES is returned, the system restarts a message sending process when running, and if NO, the next method is continuously executed;
(2) forward targetfor selector: the method can be realized by forwarding the message to other objects, and as long as the returned message is not nil or self, the method can restart the process of sending the message and forward the message to other objects for processing;
(3) method signatureforeselector: the method obtains a method signature, if the method signature is not obtained, the method directly calls a dosenscognizaeselector, if the method signature can be obtained, the system creates an NSlnvocation and sends the NSlnvocation to a forwardInvocation method;
(4) forward inside location: the method is that the previous method transmits the incoming NSlnvocation, then calls the invokeWithTarget method of the NSlnvocation, and transmits the NSlnvocation to the corresponding Target;
(5) dosnotrecognizieselector: an undiagnosed selected selector sent to 8230is thrown, an exception.
As known from the above message forwarding methods, aspects mainly utilize forwardlnvocation for forwarding, and Aspects dynamically creates a subclass to point a corresponding object isa pointer to the created subclass, and then replaces IMP of forwardlnvocation of the subclass with _ ASPECTS _ ARE _ BEING _ CALLED _. <xnotran> hook XX, Aspects _ XX , Aspects _ XX IMP XX IMP, , hook XX IMP _ objc _ msgForward, , forwardInvocation IMP __ ASPECTS _ ARE _ BEING _ CALLED __, __ ASPECTS _ ARE _ BEING _ CALLED __ , . </xnotran>
In another embodiment, the application exception handling apparatus 20 may further recover the application according to the obtained abnormal operation state information, specifically including:
a) And when the abnormal operation of the application program is detected, acquiring the latest cache information of the application program.
Specifically, the latest cache of the application program is inquired by calling the system package manager, and the latest cache of the application program comprises cache information when crash of the application program occurs.
In other embodiments, a breakpoint tool may be integrated into an application program, and when the application program runs abnormally, the breakpoint tool is used to capture abnormal running state information of the application program. The abnormal operation state information comprises array script boundary crossing, null pointer abnormity, class conversion abnormity and the like.
b) And recovering the application program according to the latest cache information.
Specifically, the application program is started, the page is jumped to when the crash happens according to the latest cache information, and the operation data on the page is restored. For example, the hot repair code is downloaded and loaded, and the hot repair code may be downloaded in an application di finishLaunchingWithOptions method, such as JavaScript patch (JPatch) or WaxPatch. In addition, in order to ensure that the repair of the code of the application program can be completed and the time for downloading and loading the hot repair code is ensured, a prompt box can be popped up, for example, a user is prompted to repair the application program.
The processing module 203 is configured to display the preset interface according to the preprocessing function.
In this embodiment, the preprocessing function is to display a preset interface. The preset interface can be a blank interface, an interface of a preset application program and a main interface of the electronic equipment.
Specifically, when the preprocessing function is to display a blank interface, displaying the current interface of the application program as the blank interface, thereby avoiding the application program from being flashed back; when the preprocessing function is to display a preset application program interface (such as a music player), starting the preset application program and displaying the preset application program interface, so that a user can be guided to execute other application programs to relieve the emotion of the user; when the preprocessing function is to display a main interface of the electronic equipment, returning to the main interface of the electronic equipment from the current interface of the application program;
in other embodiments, the corresponding operation may be executed according to the preprocessing function, where the preprocessing function includes downloading and reinstalling an application program and upgrading the application program.
Specifically, when the preprocessing function is to download and reinstall the application program, the corresponding operation is to download and reinstall the application program; and when the preprocessing function is to upgrade the application program, the corresponding operation is to upgrade the application program. Since the preprocessing functions and their corresponding operations are various, they are not listed here.
In this embodiment, after displaying the preset interface according to the preprocessing function, the application exception handling device 20 may further count the number of times of calling the preprocessing function, and may obtain the number of times of collapsing the application by counting the number of times of calling the preprocessing function.
In this embodiment, after counting the number of times of calling the preprocessing function, the application exception handling apparatus 20 may further determine whether the number of times of calling the preprocessing function within a preset time reaches a preset number of times.
When the times of calling the preprocessing function in the preset time reach the preset times, the application program is restarted or the cache data of the application program is eliminated, and the process of eliminating the cache data and restarting can solve the problem that some applications still crash after being restarted.
And when the times of calling the preprocessing function in the preset time do not reach the preset times, continuously judging whether the times of calling the preprocessing function in the preset time reach the preset times or not.
In this embodiment, the preset time may be one minute, and the preset number of times may be three times.
In summary, the application exception handling apparatus 20 according to the present invention includes a monitoring module 201, a calling module 202, and a processing module 203. The monitoring module 201 is configured to monitor an operating state of an application program in the electronic device; the calling module 202 is configured to call a preprocessing function when it is monitored that the application program is abnormal in operation, where the preprocessing function includes displaying a preset interface; and the processing module 203 is configured to display the preset interface according to the preprocessing function. The application exception handling apparatus 20 may capture the abnormal operation state information of the application when the application is abnormal, and call the preprocessing function to replace the exception message, and may analyze the abnormal operation state information when the application is abnormal, and count the number of times of calling the preprocessing function, thereby facilitating the count of the number of times of the application abnormality. No matter what reason the application program is flashed off, as long as the exception causing the flashing off can be captured, the exception is replaced, so that the application program does not flash off when the exception occurs, corresponding operation is executed, and user experience is improved.
The integrated unit implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a dual-screen device, or a network device) or a processor (processor) to execute parts of the methods according to the embodiments of the present invention.
EXAMPLE III
Fig. 3 is a schematic diagram of an electronic device according to a third embodiment of the present invention.
The electronic device 3 includes: a memory 31, at least one processor 32, a computer program 33 stored in said memory 31 and executable on said at least one processor 32, and at least one communication bus 34.
The at least one processor 32, when executing the computer program 33, implements the steps in the above-described application exception handling method embodiments.
Illustratively, the computer program 33 may be partitioned into one or more modules/units that are stored in the memory 31 and executed by the at least one processor 32 to carry out the invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 33 in the electronic device 3.
The electronic device 3 may be a device such as a mobile phone, a tablet computer, a Personal Digital Assistant (PDA) and the like, which is installed with an application program. Those skilled in the art will appreciate that the schematic diagram 3 is merely an example of the electronic device 3, and does not constitute a limitation to the electronic device 3, and may include more or less components than those shown, or combine certain components, or different components, for example, the electronic device 3 may further include an input-output device, a network access device, a bus, and the like.
The at least one Processor 32 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The processor 32 may be a microprocessor or the processor 32 may be any conventional processor or the like, and the processor 32 is a control center of the electronic device 3 and connects various parts of the whole electronic device 3 by various interfaces and lines.
The memory 31 may be used to store the computer program 33 and/or the module/unit, and the processor 32 may implement various functions of the electronic device 3 by running or executing the computer program and/or the module/unit stored in the memory 31 and calling data stored in the memory 31. The memory 31 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the electronic apparatus 3, and the like. In addition, the memory 31 may include a high speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The integrated modules/units of the electronic device 3 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
In the embodiments provided in the present invention, it should be understood that the disclosed electronic device and method can be implemented in other ways. For example, the above-described embodiments of the electronic device are merely illustrative, and for example, the division of the units is only one logical functional division, and there may be other divisions when the actual implementation is performed.
In addition, functional units in the embodiments of the present invention may be integrated into the same processing unit, or each unit may exist alone physically, or two or more units are integrated into the same unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or that the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit scope of the technical solutions of the present invention.

Claims (9)

1. An application exception handling method, the method comprising:
monitoring the running state of an application program in the electronic equipment;
when the application program is monitored to be abnormal in operation, calling a preprocessing function, intercepting abnormal information of the application program, acquiring a customized service processing logic according to the abnormal information, and processing the abnormality of the application program according to the service processing logic, wherein the preprocessing function comprises displaying a preset interface, and the preset interface comprises a blank interface, an interface of the preset application program and a main interface of the electronic equipment; and
displaying the preset interface according to the preprocessing function, wherein the displaying comprises: when the preprocessing function is to display the blank interface, displaying the current interface of the application program as the blank interface; when the preprocessing function is used for displaying the interface of the preset application program, starting the preset application program and displaying the interface of the preset application program; and when the preprocessing function is to display the main interface of the electronic equipment, returning to the main interface of the electronic equipment from the current interface of the application program.
2. The application exception handling method of claim 1, wherein the step of monitoring the running state of the application in the electronic device comprises:
acquiring configuration information of software and hardware called when an application program runs in the electronic equipment;
according to the configuration information of the software and the hardware, monitoring the calling condition of the function calling software and the hardware configured in the application program and the running condition of the software and the hardware running according to the function; and
and monitoring and analyzing the application program according to the calling condition and the running condition.
3. The method for processing the application program exception according to claim 1, wherein when the application program is monitored to run abnormally, the method further comprises the following steps:
acquiring the latest cache information of the application program;
and acquiring abnormal running state information of the application program by inquiring the latest cache information, wherein the abnormal running state information comprises array script boundary crossing, null pointer abnormity and class conversion abnormity.
4. The application exception handling method of claim 3, wherein after obtaining the application's latest cache information, the method further comprises:
skipping to a page when the application program is abnormal according to the latest cache information; and
and restoring the operation data on the page when the application program is abnormal.
5. The method for processing the application program exception, as claimed in claim 1, wherein when the application program is detected to be abnormal in operation, after the preprocessing function is called, the method further comprises: counting the number of times the preprocessing function is called,
judging whether the number of times of calling the preprocessing function in the preset time reaches the preset number of times or not;
restarting the application program when the number of times of calling the preprocessing function in the preset time reaches a preset number of times, wherein the application program is also cleared of cache data of the application program before being restarted;
and when the times of calling the preprocessing function in the preset time do not reach the preset times, continuously judging whether the times of calling the preprocessing function in the preset time reach the preset times or not.
6. The method of application exception handling of claim 1 wherein said preprocessing function further comprises downloading and reinstalling said application and upgrading said application.
7. An application exception handling apparatus, the apparatus comprising:
the monitoring module is used for monitoring the running state of an application program in the electronic equipment;
the system comprises a calling module, a processing module and a processing module, wherein the calling module is used for calling a preprocessing function when monitoring that the application program runs abnormally, intercepting abnormal information of the application program, acquiring a customized service processing logic according to the abnormal information, and processing the abnormality of the application program according to the service processing logic, wherein the preprocessing function comprises displaying a preset interface, and the preset interface comprises a blank interface, an interface of the preset application program and a main interface of the electronic equipment; and
the processing module is used for displaying the preset interface according to the preprocessing function, and comprises: when the preprocessing function is to display the blank interface, displaying the current interface of the application program as the blank interface; when the preprocessing function is used for displaying the interface of the preset application program, starting the preset application program and displaying the interface of the preset application program; and when the preprocessing function is to display the main interface of the electronic equipment, returning to the main interface of the electronic equipment from the current interface of the application program.
8. An electronic device, characterized in that the electronic device comprises a processor and a memory, the processor being configured to implement the application exception handling method according to any one of claims 1 to 6 when executing the computer program stored in the memory.
9. A computer-readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing the application exception handling method according to any one of claims 1 to 6.
CN201811142667.XA 2018-09-28 2018-09-28 Application program exception handling method and device, electronic equipment and storage medium Active CN109284217B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811142667.XA CN109284217B (en) 2018-09-28 2018-09-28 Application program exception handling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811142667.XA CN109284217B (en) 2018-09-28 2018-09-28 Application program exception handling method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109284217A CN109284217A (en) 2019-01-29
CN109284217B true CN109284217B (en) 2023-01-10

Family

ID=65182521

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811142667.XA Active CN109284217B (en) 2018-09-28 2018-09-28 Application program exception handling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109284217B (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162479B (en) * 2019-05-29 2023-09-29 Oppo广东移动通信有限公司 Abnormal application detection method and device and terminal equipment
CN110187934B (en) * 2019-05-29 2022-06-28 柴森森 Application control method, terminal and computer readable storage medium
CN110532178A (en) * 2019-08-09 2019-12-03 四川虹美智能科技有限公司 A kind of Android system library file collapse location positioning method and device
CN110825396B (en) * 2019-10-31 2023-07-25 Oppo(重庆)智能科技有限公司 Exception handling method and related equipment
CN110865920B (en) * 2019-11-05 2023-08-29 RealMe重庆移动通信有限公司 Startup exception processing method and device, electronic equipment and storage medium
CN110908869B (en) * 2019-11-27 2023-06-30 北京博睿宏远数据科技股份有限公司 Application program data monitoring method, device, equipment and storage medium
CN111176874B (en) * 2019-12-23 2022-04-12 京东科技控股股份有限公司 Processing method, device and equipment for abnormal exit of application program and storage medium
CN111143095B (en) * 2019-12-31 2023-12-29 张杰辉 Mobile device application program compatibility flash back prevention method and system
CN111399845A (en) * 2020-03-12 2020-07-10 北京字节跳动网络技术有限公司 Assertion method, assertion device, electronic equipment and computer readable medium
CN111611094A (en) * 2020-05-26 2020-09-01 山东汇贸电子口岸有限公司 Monitoring and managing method for abnormal MQ information
CN112181761B (en) * 2020-09-21 2023-01-31 广州虎牙科技有限公司 Program execution control method, program execution test device, code detection device, program execution equipment and medium
CN114625428B (en) * 2020-12-10 2024-03-26 荣耀终端有限公司 Application exception processing method and electronic equipment
CN112559248A (en) * 2020-12-23 2021-03-26 深圳市彬讯科技有限公司 Preprocessing service recovery method, device, equipment and storage medium
CN114913649A (en) * 2021-02-09 2022-08-16 腾讯科技(深圳)有限公司 Display state monitoring method, device, equipment and computer readable storage medium
CN113064798A (en) * 2021-04-25 2021-07-02 上海商汤临港智能科技有限公司 Exception handling method and device, electronic equipment and system
CN113282458A (en) * 2021-05-25 2021-08-20 挂号网(杭州)科技有限公司 Anti-flash-back method and device for application program, electronic equipment and storage medium
CN113485929A (en) * 2021-07-12 2021-10-08 北大方正集团有限公司 Data processing method, device, equipment, storage medium and program product
CN113742122A (en) * 2021-08-19 2021-12-03 深圳Tcl新技术有限公司 Exception handling method and device, storage medium and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014107511A2 (en) * 2013-01-07 2014-07-10 Abb Inc. System and method for developing, deploying and implementing power system computer applications
CN104750041A (en) * 2013-12-27 2015-07-01 研祥智能科技股份有限公司 Method and system for monitoring anomaly in WinCE system
CN105843741A (en) * 2016-03-24 2016-08-10 腾讯科技(深圳)有限公司 Information processing method and device for application program
CN106055421A (en) * 2016-05-30 2016-10-26 Tcl海外电子(惠州)有限公司 Intelligent terminal and exception processing method thereof
CN107291586A (en) * 2016-04-01 2017-10-24 腾讯科技(深圳)有限公司 The analysis method and device of a kind of application program
CN108334415A (en) * 2017-01-20 2018-07-27 百度在线网络技术(北京)有限公司 A kind of fault-tolerance processing method, device, terminal and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105117110B (en) * 2015-09-15 2018-03-30 北京金山安全软件有限公司 Method and device for displaying user equipment state on preset interface of application program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014107511A2 (en) * 2013-01-07 2014-07-10 Abb Inc. System and method for developing, deploying and implementing power system computer applications
CN104750041A (en) * 2013-12-27 2015-07-01 研祥智能科技股份有限公司 Method and system for monitoring anomaly in WinCE system
CN105843741A (en) * 2016-03-24 2016-08-10 腾讯科技(深圳)有限公司 Information processing method and device for application program
CN107291586A (en) * 2016-04-01 2017-10-24 腾讯科技(深圳)有限公司 The analysis method and device of a kind of application program
CN106055421A (en) * 2016-05-30 2016-10-26 Tcl海外电子(惠州)有限公司 Intelligent terminal and exception processing method thereof
CN108334415A (en) * 2017-01-20 2018-07-27 百度在线网络技术(北京)有限公司 A kind of fault-tolerance processing method, device, terminal and storage medium

Also Published As

Publication number Publication date
CN109284217A (en) 2019-01-29

Similar Documents

Publication Publication Date Title
CN109284217B (en) Application program exception handling method and device, electronic equipment and storage medium
CN106844136B (en) Method and system for collecting program crash information
US9037914B1 (en) Error handling for widgets
CN109656773B (en) Processing framework based on IOS application abnormal crash
US9747449B2 (en) Method and device for preventing application in an operating system from being uninstalled
CN111367698B (en) Application program flash back detection and processing method and device and electronic equipment
CN110413432B (en) Information processing method, electronic equipment and storage medium
CN102999343A (en) Method and device for forbidding self-starting of startup project
CN110457154B (en) Abnormal service processing method and device, storage medium and communication terminal
CN110377341B (en) Method, device, medium and electronic equipment for monitoring no-response exception
CN108334415A (en) A kind of fault-tolerance processing method, device, terminal and storage medium
CN112000353A (en) Application running method and device and storage medium
US20170373957A1 (en) Minimized installation of point of presence software agents by use of pre-installed browser
CN110704131B (en) Method and device for calling native application by HTML5 application
CN107577527B (en) Task generation and scheduling method and device
CN111061448A (en) Log information display method and device, electronic equipment and storage medium
CN107967192B (en) System crash processing method and device for intelligent terminal
CN113760611A (en) System site switching method and device, electronic equipment and storage medium
CN113467981A (en) Exception handling method and device
CN113282435B (en) Application exception processing method and electronic equipment
CN115269252A (en) Application program fault processing method, device, equipment and storage medium
CN114928603A (en) Client software upgrading method and device, electronic equipment and medium
CN112052054A (en) Function calling method and device, electronic equipment and storage medium
CN115952491B (en) Method, device, electronic equipment and medium for hook objective function
CN116225576B (en) Application program data environment switching method and device, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant