CN113626245B - Method for preventing ios application program from crashing - Google Patents

Method for preventing ios application program from crashing Download PDF

Info

Publication number
CN113626245B
CN113626245B CN202110992595.3A CN202110992595A CN113626245B CN 113626245 B CN113626245 B CN 113626245B CN 202110992595 A CN202110992595 A CN 202110992595A CN 113626245 B CN113626245 B CN 113626245B
Authority
CN
China
Prior art keywords
crash
file
application program
ios application
processed
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
CN202110992595.3A
Other languages
Chinese (zh)
Other versions
CN113626245A (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.)
Sichuan Hongmei Intelligent Technology Co Ltd
Original Assignee
Sichuan Hongmei Intelligent Technology 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 Sichuan Hongmei Intelligent Technology Co Ltd filed Critical Sichuan Hongmei Intelligent Technology Co Ltd
Priority to CN202110992595.3A priority Critical patent/CN113626245B/en
Publication of CN113626245A publication Critical patent/CN113626245A/en
Application granted granted Critical
Publication of CN113626245B publication Critical patent/CN113626245B/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/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0793Remedial or corrective actions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention provides a method for preventing ios application program from crashing, which comprises the following steps: after the ios application program is started, starting and running a crash protection code; when the ios application program runs, monitoring whether the ios application program is in a crash abnormity in the running process of the message forwarding stage by the crash protection code, if the crash abnormity is monitored, rewriting the corresponding crash code segment in the running process by the crash protection code to realize the repair of the ios application program, and uploading the crash code segment to the cloud server; and performing visual analysis on each received collapse code segment through the cloud server, so that developers of the ios application program perform offline repair on the collapse code segments according to the analysis result, and perform version update on the ios application program according to the repaired codes. The invention can avoid the condition that the ios application program is crashed or flashed off during the operation, and the user is not sensible in the process, thereby not influencing the normal use of the user.

Description

Method for preventing ios application program from crashing
Technical Field
One or more embodiments of the present specification relate to the technical field of ios application programs, and in particular, to a method for preventing ios application programs from crashing.
Background
In the current social environment, with the rapid popularization of smart phones, mobile phone APPs are also used more and more by people. Once the APP is released online, a developer is unfamiliar with the user's hand, and the crash and flash back caused by the on-line release of the APP are also insufficient, so that the user experience of using the APP is greatly influenced. How to prevent the crash from occurring becomes a technical problem faced by many mobile internet companies.
Disclosure of Invention
One or more embodiments of the present specification describe a method of preventing ios applications from crashing.
The invention provides a method for preventing ios application program from crashing, which comprises the following steps:
s100, after the ios application program is started, starting and running a crash protection code;
s200, when the ios application program runs, monitoring whether the ios application program is in a crash abnormal running process in a message forwarding stage by the crash protection code through a key value observer event notification mechanism, if the crash abnormal running process is monitored, rewriting the code of a crash code segment corresponding to the running process by the crash protection code to realize the repair of the ios application program, and uploading the crash code segment to a cloud server;
s300, performing visual analysis on each received crash code segment through the cloud server, so that developers of the ios application program perform offline repair on the crash code segments according to analysis results, and performing version update on the ios application program according to repaired codes.
The method for preventing ios application program from crashing provided by the embodiment of the specification starts to start the crash protection code when the ios application program is started, the crash protection code monitors the message forwarding stage for crash abnormity by adopting a key value observer event notification mechanism, rewrites the crash code segment when the crash abnormity occurs, and uploads the crash code segment to the cloud server so as to be analyzed and repaired by a worker, thereby providing a better version to update the version with the crash abnormity. That is to say, when the crash exception occurs, the crash protection code performs crash protection, so that the situation that the ios application program crashes or flashes is avoided, and in addition, the user is not sensible in the process, and the normal use of the user cannot be influenced. Meanwhile, the crash code segments are uploaded to a cloud server for analysis and statistics, so that powerful data support is provided for the subsequent iterative optimization of the ios application program. Because the code rewriting operation is only carried out when the crash is abnormal, the running of the ios application program has no occupation of system resources such as performance and memory.
Drawings
In order to more clearly illustrate the embodiments of the present specification 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, and it is obvious that the drawings in the following description are some embodiments of the present specification, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flow diagram illustrating a method for preventing ios applications from crashing, according to an embodiment of the present invention.
Detailed Description
The scheme provided by the specification is described below with reference to the accompanying drawings.
The invention provides a method for preventing ios application program from crashing, as shown in FIG. 1, the method comprises the following steps S100-S300:
s100, after the ios application program is started, starting and running a crash protection code;
the crash protection code is used for performing crash protection on the operation of the ios application program. The crash protection code is launched whenever the ios application is launched.
In specific implementation, the crash protection code can be integrated into a plug-in by adopting an SDK, wherein the SDK means a software development kit, and the crash protection code is integrated into a plug-in through the software development kit, so that the crash protection code can be inserted into different ios application programs in the form of plug-ins, and the crash protection of various ios application programs is realized. In addition, the plug-in may be further embedded in the app code of the ios application program in a manner of facet-oriented programming, that is, the plug-in may be embedded in the app code of the ios application program in a manner of facet-oriented programming. The method is an AOP (aspect oriented programming) method, which does not modify the source code at the bottom layer of the system, and the conventional implantation method needs to modify the source code at the bottom layer, so that the AOP method has extremely small invasion to the app code, and performance loss is not caused.
S200, when the ios application program runs, monitoring whether the ios application program is in a crash abnormal running process in a message forwarding stage by the crash protection code through a key value observer event notification mechanism, if the crash abnormal running process is monitored, rewriting the code of a crash code segment corresponding to the running process by the crash protection code to realize the repair of the ios application program, and uploading the crash code segment to a cloud server;
when the ios application program runs, if the message sending stage is wrong and the correct sending of the message is not realized, the ios application program enters a message forwarding stage. The crash protection code plays its crash protection role in the message forwarding stage.
Among them, the Key Value Observer event notification mechanism is KVO (all called Key-Value-Observer) event notification mechanism. A key-value observer event notification mechanism is a set of event notification mechanisms provided by ios systems that allow an object to listen for changes in a particular property of another object and receive events when changed. For example, observer a listens to some attribute of observed B, and when the attribute of B changes, a receives a notification and executes the corresponding method.
The method comprises the steps of rewriting a crash code segment, actually replacing an original crash code with a corresponding new code, executing the rewriting process by a crash protection code, and realizing the repair of the crash code in a rewriting mode.
In practice, the message forwarding phase may include three sub-phases: the method comprises a parsing sub-phase (i.e. a sub-phase corresponding to a resolveInstanceMethod), a fast forwarding sub-phase (i.e. a sub-phase corresponding to a forwarding TargetForselector), and a slow forwarding sub-phase (i.e. a sub-phase corresponding to a method SignatureForSelector). Crash protection may be implemented for these three sub-phases in a specific implementation. That is, S200 may specifically include:
s210, judging whether a first object method or a first class method is called by the crash protection code in a method analysis sub-stage of the message forwarding stage, wherein the first object method is an object method corresponding to the current operation process of the ios application program, and the first class method is a class method corresponding to the current operation process of the ios application program;
if yes, entering the next sub-stage of the method analysis sub-stage to perform crash exception monitoring;
otherwise, the method analyzes that the sub-stage has the crash exception, takes the app code segment corresponding to the current running process as the crash code segment, and rewrites the crash code segment.
It can be understood that, in the above process, the key value observer event notification mechanism is used to perform crash monitoring on the method parsing sub-phase, that is, the key value observer event notification mechanism is used to determine whether the method parsing sub-phase calls the first object method or the first class method. The first object method or the first class method is an object method or a class method corresponding to a function executed by the current running process of the ios application program, for example, if the ios application program currently executes a login function, the first object method or the first class method is an object method or a class method capable of realizing the login function.
It can be understood that if the first type of method or the first object method is called in the method parsing sub-phase, which indicates that the execution process of the method parsing sub-phase is successful, the next sub-phase can be entered, and thus the next sub-phase is entered for performing crash exception monitoring. If the first object method or the first type of method is not called in the method analysis sub-phase, the method analysis sub-phase is failed, and the method analysis sub-phase is likely to crash because the execution of the sub-phase fails, so that the method analysis sub-phase is considered to have a crash exception at this time, and the currently corresponding crash code segment is rewritten.
In a specific implementation, when it is necessary to enter a next sub-phase of the analysis sub-phase of the method to perform crash exception monitoring, the S200 may further include:
s220, judging whether the crash protection code can find the sub-object responding to the first object method or the first class method in a preset object list in the fast forwarding sub-stage;
if yes, entering the next sub-stage of the fast forwarding sub-stage to perform crash exception monitoring;
otherwise, the fast forwarding sub-stage is in crash exception, the app code segment corresponding to the current running process is used as the crash code segment, and the crash code segment is rewritten.
It is understood that a plurality of sub-objects are included in the preset object list, and different sub-objects can respond to different object methods or class methods.
It can be understood that, in the above process, the key value observer event notification mechanism is used to perform crash monitoring on the fast forwarding sub-stage, that is, the key value observer event notification mechanism is used to determine whether the fast forwarding sub-stage can find the sub-object responding to the first object method or the first class method to perform monitoring. It can be understood that, in order to implement the function corresponding to the current operation process of the ios application, the first type of method or the first object method needs to be called, and since the first type of method or the first object method is not called in the method parsing sub-stage, a sub-object capable of responding to the first type of method or the first object method needs to be found to implement the function corresponding to the current operation process of the ios application.
It can be understood that if a sub-object responding to the first method or the first object method can be found, the fast forwarding sub-stage can realize the function of the sub-stage through the sub-object, and then enter the next sub-stage to perform crash exception monitoring. If the sub-object is not found in the fast forwarding sub-stage, it indicates that the fast forwarding sub-stage is failed, and a crash may occur due to the execution failure of the sub-stage, so that it is considered that a crash exception occurs in the fast forwarding sub-stage at this time, and the rewrite operation is performed on the currently corresponding crash code segment.
In specific implementation, when the next sub-stage that needs to enter the fast forwarding sub-stage is to perform crash exception monitoring, the S200 may further include:
s230, in the slow forwarding sub-stage, the crash protection code switches the preset object list into a corresponding associated object list, and judges whether an associated sub-object responding to the first object method or the first class method can be found in the associated object list;
if yes, the operation process of the message forwarding stage is not in crash abnormity;
otherwise, the slow forwarding sub-stage is in crash exception, the app code segment corresponding to the current running process is used as the crash code segment, and the crash code segment is rewritten.
It will be appreciated that a plurality of association sub-objects are included in the association object list, which are capable of responding to different object methods or class methods. The preset object list and the associated object list are associated.
It can be understood that, in the above process, the key value observer event notification mechanism is used to perform crash monitoring on the slow forwarding sub-stage, that is, the key value observer event notification mechanism is used to determine whether the fast forwarding sub-stage can find the associated sub-object responding to the first object method or the first class method to perform monitoring. In the fast forwarding sub-stage, no sub-object capable of responding to the first object method or the first object method is found in the preset object list, so that the related sub-object capable of responding to the first object method or the first object method is found in the related object list, the preset object list needs to be switched to a corresponding related object list before the related sub-object is found, and only if the related sub-object capable of responding to the first object method or the first object method is found, the function corresponding to the current operation process of the ios application program can be realized.
It can be understood that if an associated sub-object responding to the first method or the first object method can be found, the slow forwarding sub-stage can realize the function of the sub-stage through the associated sub-object, and thus, no crash exception occurs in the whole operation process of the message forwarding stage. If the associated sub-object is not found in the slow forwarding sub-stage, it indicates that the slow forwarding sub-stage is failed, and there is a possibility that the slow forwarding sub-stage is crashed due to the execution failure of the sub-stage, so that it is considered that the crash exception occurs in the slow forwarding sub-stage at this time, and the rewriting operation is performed on the currently corresponding crashed code segment.
The three steps are used for realizing crash exception monitoring on the three sub-stages of the message forwarding stage and rewriting to repair codes when crash exception occurs. Since the crash code segment is sent to the cloud server in the above process, the cloud server can execute S300.
S300, performing visual analysis on each received crash code segment through the cloud server, so that developers of the ios application program perform offline repair on the crash code segments according to analysis results, and performing version update on the ios application program according to repaired codes.
In the implementation process, when the cloud server receives a plurality of crash code segments, the cloud server performs visual analysis on the crash code segments so as to enable people to know the crash code segments. The specific analysis may be to accumulate the received times of the same crash code segment, and then sort the different crash code segments according to the accumulated receiving times, so that the worker can sequentially perform the offline repair from the order of the highest accumulated receiving times to the lowest. If the accumulated receiving times of a crash code segment are more, the influence of the crash code segment on the use of a user is more, so that the crash code segment with the most accumulated receiving times is repaired first, and then the crash code segments with the most accumulated receiving times are repaired until all the crash code segments are repaired. When all the broken code segments are repaired, a new version can be formed according to the repaired code segments, and the new version is put on line to update the ios application program of the previous version, so that the ios application program of the previous version is comprehensively repaired.
That is, the process of performing the visualization analysis in S300 may include: and accumulating the receiving times of the same crash code segment through the cloud server, and sequencing different crash code segments according to the sequence of the accumulated receiving times from high to low, so that the developer sequentially carries out offline repair on each crash code segment according to the sequencing.
The rewriting can adopt runtime to realize the optimized substitution of the crash code segment, silence and prevent the crash, and ensure the normal operation of the application program.
For example, when a user starts an ios application program, a crash protection code starts to monitor whether the ios application program has a crash abnormality in a message conversion stage, when the monitoring abnormality occurs, the code is rewritten to realize repair, the user can continue to use the ios application program after the repair is completed, and the process is extremely short in time consumption and cannot be perceived by the user. And the collapse code segment is uploaded to the cloud server, and the cloud server performs statistical analysis on the collapse code segment, so that developers can repair the collapse code segment according to an analysis result, and the abnormal root source is repaired once and for all, and then the ios application program of the previous version is updated in version, so that the collapse problem is thoroughly solved. When no crash exception occurs, the user normally uses the ios application.
The method for preventing ios application program from crashing provided by the invention starts to start the crash protection code when the ios application program is started, the crash protection code monitors the message forwarding stage for crash abnormity by adopting a key value observer event notification mechanism, rewrites the crash code segment when the crash abnormity occurs, and uploads the crash code segment to the cloud server so as to be convenient for a worker to analyze and repair, thereby providing a better version to update the version with the crash abnormity. That is to say, when the crash exception occurs, the crash protection code performs crash protection, so that the situation that the ios application program crashes or flashes is avoided, and in addition, the user is not sensible in the process, and the normal use of the user cannot be influenced. Meanwhile, the crash code segment is uploaded to a cloud server for analysis and statistics, so that powerful data support is provided for subsequent iterative optimization of the ios application program. Because the code rewriting operation is only carried out when the crash is abnormal, the running of the ios application program has no occupation of system resources such as performance and memory.
In particular, in addition to the crash caused by the code segment problem, the crash problem may also be caused by too much cache data, so that too much memory is occupied and the normal operation cannot be performed. Aiming at the problem of crash caused by the problem, the invention can also comprise the following steps:
s400, a framework layer of an operating system of the intelligent device where the ios application program is located obtains identification information of the ios application program and a file directory of the ios application program after an installation compression packet is decompressed in the installation process;
the framework of the operating system comprises three layers, namely an application layer, a framework layer and a kernel layer. Here, identification information and directory information of the application program are recorded through the framework layer.
It will be appreciated that the installation compact package for ios applications is typically a data compact package in a fixed format that the operating system can recognize, ending with a certain suffix name. When the ios application program is installed, the operating system decompresses the installation compressed package to generate a folder structure. And the framework layer of the operating system records the decompressed file directory. And the framework layer also records the identification information of the ios application program, wherein the identification information is the unique identification information of the ios application program. And the framework layer stores the acquired file directory and the identification information locally.
S500, when the ios application program is started to operate for the first time, the ios application program calls a new file interface of the framework layer, and file information of a cache file generated in the operation process is transmitted to the framework layer through the new file interface; the file system of the operating system generates a corresponding file or folder under the file directory according to the file information received by the framework layer, so that the ios application program stores the cache file into the generated file or folder, and generates an information association table, wherein the information association table is used for storing the mapping relationship between the file information and the corresponding file or folder;
wherein the file information includes a file name, a path, and a suffix name.
That is to say, when the ios application program is started for the first time, the ios application program calls the new file interface, and then transfers file information such as a file name, a path, a suffix name and the like corresponding to a cache file generated in the running process to the framework layer through the interface, so that the file system can generate a new file and a new folder according to the information to store the cache file, and simultaneously generate an information association table to store the corresponding relationship between the file information and the file and the folder.
It will be appreciated that new files and folders are only generated when the ios application is first launched and run, and an information association table is created. The generated new files and folders are used for storing cache files generated in the running process of the application program, wherein the cache files comprise crash logs of the application program, pictures and videos which are viewed by a user on the application program, downloaded audio/video and pictures, screenshots of the user and contents which have higher requirements on real-time property and are accessed by the user.
That is, after the framework layer receives the file information, the file system generates a file and a folder according to the file information, the generated file and folder are located in the file directory, the specific location is determined according to different contents of the cache file, and the cache file is stored and classified through the generated file and folder. And meanwhile, an information association table is also generated and used for storing the corresponding relation between the file information of all the cache files and the files and folders.
It can be understood that the mapping relationship between the file information of the cache file in one ios application program and the file and the folder can be stored in the information association table, the mapping relationship between the file information of the cache file in a plurality of ios application programs and the file and the folder can also be stored, and the mapping relationships corresponding to different ios application programs can be distinguished through the identification information.
When the ios application program is not operated for the first time, if files and folders for storing the same type of cache files exist in the file directory, the cache files generated in the operation process only need to be stored in the files and the folders, new files and folders do not need to be generated, and in order to distinguish cache data generated in the same type of application program in different time periods, names of the files and the folders can be distinguished by dates. If the files and folders of the same type of cache files do not exist in the file directory during non-first-time operation, the corresponding files and folders also need to be generated, and a new corresponding relation is added in the information association table.
S600, when the ios application program deletes a cache file, calling an API (application programming interface) of the framework layer, and transmitting a deletion request to the framework layer through the API; and the frame layer searches a path of the file to be processed or the folder to be processed in the information association table according to the file information in the deletion request, searches the corresponding file to be processed or the folder to be processed in the file directory according to the path, deletes the file to be processed or the folder to be processed, and updates the information association table.
Therefore, when the cache file is deleted, the file to be processed or the folder to be processed is found in the file directory through the information association table, so that the file to be processed or the folder to be processed is deleted, and meanwhile, the information association table is updated.
In specific implementation, in order to ensure the correspondence between the files and folders in the information association table and the file directory, the method provided by the invention may further include:
s700, when the operating system is started each time, the frame layer reads the information association table, scans files and folders in the file directory, judges whether the information obtained after scanning is consistent with the information read from the information association table or not, and corrects the information association table according to the information obtained after scanning if the information obtained after scanning is not consistent with the information read from the information association table.
Namely, consistency comparison is carried out on the information association table and the cache file every time the operating system is started, and the information association table is corrected according to the cache file when the operating system is inconsistent, so that the truth and correctness of the information association table are ensured. For example, after the cache file is deleted, if the update of the information association table is incorrect but not correctly updated, the cache file and the information association table may be inconsistent, so that the information association table is corrected according to the cache file when the operating system is started, thereby solving the problem.
It can be understood that, in the above process, the cache files are deleted one by one, and the possibility of incorrect deletion is relatively low in this process, but there is a possibility of incorrect deletion occurring during batch deletion, and in order to reduce the occurrence of this situation, the method provided by the present invention may further include:
s800, when the framework layer receives a deletion request of the ios application program for batch cache files, according to file information in the deletion request, finding a path of a corresponding file to be processed or a corresponding folder to be processed in the information association table, according to the path, finding the corresponding file to be processed or the corresponding folder to be processed in the file directory, classifying the file to be processed or the folder to be processed into first-class cache data and second-class cache data according to attribute information of the file to be processed or the folder to be processed, deleting the first-class cache data, displaying a selection interface, displaying the second-class cache data on the selection interface, responding to a selection operation of a user on the selection interface, selectively deleting the second-class cache data, and updating the information association table according to the deleted data.
After the files to be processed or the folders to be processed are found in the file directory according to the information association table, the files need to be classified into first-class cache data and second-class cache data, the first-class cache data can be directly deleted, the second-class cache data needs to be selectively deleted, a selection interface is specifically displayed, and a user can perform selection operation on the selection interface and then delete the files according to the selection of the user. After the deletion operation is completed, the information association table is updated.
In specific implementation, the cache files are classified according to the attribute information of the cache files. The attribute information may include a preset flag, where the preset flag is 1 if the cached file is a file autonomously downloaded by the user, and otherwise the preset flag is 0. That is, each cache file has a preset flag indicating whether the cache file is the content that the user independently downloads. Thus the classification process in S800 may include: and judging whether the preset mark is 1, if so, the file to be processed or the folder to be processed is the second type of cache data, and if not, the file to be processed or the folder to be processed is the first type of cache data. Because the content automatically downloaded by the user may be important and the influence caused by the false deletion is large, the second type of cache data is selectively deleted by the user, and the situation of the false deletion can be reduced to a certain extent.
It can be seen that new files and folders are generated under the file directory after the installation of the compressed package and decompression for storing the cache data, and an information association table is also generated for recording the mapping relationship between the file information and the files and folders. By the method, the cache file can be accurately found, and then deleted and cleaned in time, so that the possibility of mistaken deletion is reduced, and the problem of crash caused by too many cache files is solved. And the method is not limited to factors such as upgrading of ios application programs and the like, and is very flexible.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Those skilled in the art will recognize that the functionality described in this disclosure may be implemented in hardware, software, firmware, or any combination thereof, in one or more of the examples described above. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium.
The above-mentioned embodiments, objects, technical solutions and advantages of the present invention are further described in detail, it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made on the basis of the technical solutions of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method of preventing ios application crashes, comprising:
s100, after the ios application program is started, starting and running a crash protection code;
s200, when the ios application program runs, monitoring whether the ios application program is in a crash abnormal running process in a message forwarding stage by the crash protection code through a key value observer event notification mechanism, if the crash abnormal running process is monitored, rewriting the code of a crash code segment corresponding to the running process by the crash protection code to realize the repair of the ios application program, and uploading the crash code segment to a cloud server;
s300, performing visual analysis on each received crash code segment through the cloud server, so that developers of the ios application program perform offline repair on the crash code segments according to analysis results, and performing version update on the ios application program according to repaired codes.
2. The method according to claim 1, wherein the S200 specifically includes:
the crash protection code judges whether a first object method or a first class method is called in a method analysis sub-stage of the message forwarding stage, wherein the first object method is an object method corresponding to the current running process of the ios application program, and the first class method is a class method corresponding to the current running process of the ios application program;
if yes, entering the next sub-stage of the method analysis sub-stages to perform crash exception monitoring;
otherwise, the method analyzes that the sub-stage has the crash exception, takes the app code segment corresponding to the current running process as the crash code segment, and rewrites the crash code segment.
3. The method according to claim 2, wherein the method parses a next sub-stage of the sub-stages into a fast forwarding sub-stage, and the S200 specifically further includes:
the crash protection code judges whether a sub-object responding to the first object method or the first class method can be found in a preset object list in the fast forwarding sub-stage;
if yes, entering the next sub-stage of the fast forwarding sub-stage to perform crash exception monitoring;
otherwise, the fast forwarding sub-stage is in crash exception, the app code segment corresponding to the current running process is used as the crash code segment, and the crash code segment is rewritten.
4. The method according to claim 3, wherein the next sub-stage of the fast forwarding sub-stage is a slow forwarding sub-stage, and the S200 further includes:
the crash protection code switches the preset object list into a corresponding associated object list in the slow forwarding sub-stage, and judges whether an associated sub-object responding to the first object method or the first class method can be found in the associated object list;
if yes, the operation process of the message forwarding stage is not in crash abnormity;
otherwise, the slow forwarding sub-stage is in crash exception, the app code segment corresponding to the current running process is used as the crash code segment, and the crash code segment is rewritten.
5. The method of claim 1, wherein visually analyzing, by the cloud server, each of the received crashed code segments comprises:
accumulating the receiving times of the same collapse code segment through the cloud server, and sequencing different collapse code segments according to the sequence of the accumulated receiving times from high to low, so that the developer sequentially performs offline repair on all the collapse code segments according to the sequencing.
6. The method of claim 1, wherein the crash protection code is integrated as a plug-in using SDK and is embedded in app code of the ios application using cut-plane oriented programming.
7. The method of claim 1, further comprising:
s400, a framework layer of an operating system of the intelligent device where the ios application program is located acquires identification information of the ios application program and a file directory after decompression of an installation compression packet of the ios application program in an installation process;
s500, when the ios application program is started to operate for the first time, the ios application program calls a new file interface of the framework layer, and file information of a cache file generated in the operation process is transmitted to the framework layer through the new file interface; the file system of the operating system generates a corresponding file or folder under the file directory according to the file information received by the framework layer, so that the ios application program stores the cache file into the generated file or folder, and generates an information association table, wherein the information association table is used for storing the mapping relationship between the file information and the corresponding file or folder;
s600, when the ios application program deletes a cache file, calling an API (application programming interface) of the framework layer, and transmitting a deletion request to the framework layer through the API; and the frame layer searches a path of the file to be processed or the folder to be processed in the information association table according to the file information in the deletion request, searches the corresponding file to be processed or the folder to be processed in the file directory according to the path, deletes the file to be processed or the folder to be processed, and updates the information association table.
8. The method of claim 7, further comprising:
s700, when the operating system is started each time, the frame layer reads the information association table, scans files and folders in the file directory, judges whether the information obtained after scanning is consistent with the information read from the information association table or not, and corrects the information association table according to the information obtained after scanning if the information obtained after scanning is not consistent with the information read from the information association table.
9. The method of claim 8, further comprising:
s800, when the framework layer receives a deletion request of the ios application program for batch cache files, according to file information in the deletion request, a path of a corresponding file to be processed or a corresponding folder to be processed is found in the information association table, according to the path, the corresponding file to be processed or the corresponding folder to be processed is found in the file directory, according to attribute information of the file to be processed or the folder to be processed, the file to be processed or the folder to be processed is classified into first type cache data and second type cache data, the first type cache data is deleted, a selection interface is displayed, the second type cache data is displayed on the selection interface, the selection operation of a user on the selection interface is responded, the second type cache data is selectively deleted, and the information association table is updated according to the deleted data.
10. The method according to claim 9, wherein the attribute information includes a preset flag, and the preset flag is 1 if the cached file is a file autonomously downloaded by a user, and is 0 otherwise; the classifying the file to be processed or the folder to be processed into a first type of cache data and a second type of cache data according to the attribute information of the file to be processed or the folder to be processed includes: and judging whether the preset mark is 1, if so, determining that the file to be processed or the folder to be processed is second-class cache data, and otherwise, determining that the file to be processed or the folder to be processed is first-class cache data.
CN202110992595.3A 2021-08-27 2021-08-27 Method for preventing ios application program from crashing Active CN113626245B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110992595.3A CN113626245B (en) 2021-08-27 2021-08-27 Method for preventing ios application program from crashing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110992595.3A CN113626245B (en) 2021-08-27 2021-08-27 Method for preventing ios application program from crashing

Publications (2)

Publication Number Publication Date
CN113626245A CN113626245A (en) 2021-11-09
CN113626245B true CN113626245B (en) 2023-04-07

Family

ID=78388007

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110992595.3A Active CN113626245B (en) 2021-08-27 2021-08-27 Method for preventing ios application program from crashing

Country Status (1)

Country Link
CN (1) CN113626245B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334415A (en) * 2017-01-20 2018-07-27 百度在线网络技术(北京)有限公司 A kind of fault-tolerance processing method, device, terminal and storage medium
CN109656773A (en) * 2017-10-12 2019-04-19 卓望数码技术(深圳)有限公司 A kind of processing frame collapsed extremely based on the application of IOS system
CN111124712A (en) * 2019-12-20 2020-05-08 北京奇艺世纪科技有限公司 Event notification method, device, server and storage medium
CN111813695A (en) * 2020-08-21 2020-10-23 网易(杭州)网络有限公司 Code detection method, device, medium and electronic equipment
CN112835762A (en) * 2021-01-29 2021-05-25 北京奇艺世纪科技有限公司 Data processing method and device, storage medium and electronic equipment
CN113127242A (en) * 2020-01-10 2021-07-16 北京新氧科技有限公司 Application crash processing method and processing device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334415A (en) * 2017-01-20 2018-07-27 百度在线网络技术(北京)有限公司 A kind of fault-tolerance processing method, device, terminal and storage medium
CN109656773A (en) * 2017-10-12 2019-04-19 卓望数码技术(深圳)有限公司 A kind of processing frame collapsed extremely based on the application of IOS system
CN111124712A (en) * 2019-12-20 2020-05-08 北京奇艺世纪科技有限公司 Event notification method, device, server and storage medium
CN113127242A (en) * 2020-01-10 2021-07-16 北京新氧科技有限公司 Application crash processing method and processing device
CN111813695A (en) * 2020-08-21 2020-10-23 网易(杭州)网络有限公司 Code detection method, device, medium and electronic equipment
CN112835762A (en) * 2021-01-29 2021-05-25 北京奇艺世纪科技有限公司 Data processing method and device, storage medium and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈龙.基于iOS的性能监测以及Crash防护系统的研究与实现.《中国优秀硕士学位论文全文数据库信息科技辑》.2018,(第08期),第I138-143页. *

Also Published As

Publication number Publication date
CN113626245A (en) 2021-11-09

Similar Documents

Publication Publication Date Title
KR101003888B1 (en) Tri-phase boot process in electronic devices
CN108399132B (en) Scheduling test method, device and storage medium
US10114630B2 (en) Management of software and operating system updates required for the process of creating a virtual machine facsimile of an existing physical or virtual machine
US8719810B2 (en) Program upgrade system and method for over the air-capable mobile terminal
US20150331882A1 (en) Redundant file deletion method, apparatus and storage medium
WO2021249266A1 (en) System updating method and apparatus, electronic device, and computer readable storage medium
CN109344277B (en) Picture processing method, device, medium and computing equipment
CN106980565B (en) Upgrading process monitoring method and device
CN111190573A (en) Application program point burying method and device and electronic equipment
CN111698558A (en) Television software upgrading method, television terminal and computer readable storage medium
CN117056115B (en) Application program repairing method and device, storage medium and electronic equipment
CN112286543B (en) Application service deployment method and device
CN113626245B (en) Method for preventing ios application program from crashing
CN116048609A (en) Configuration file updating method, device, computer equipment and storage medium
CN115080114A (en) Application program transplanting processing method, device and medium
CN115543429A (en) Project environment building method, electronic equipment and computer readable storage medium
CN113626391B (en) Processing method for cache file of operating system
CN115964061A (en) Plug-in updating method and device, electronic equipment and computer readable storage medium
CN114968963A (en) File overwriting method and device and electronic equipment
CN109634636B (en) Application processing method, device, equipment and medium
CN114237976A (en) Data acquisition method and device
CN112631646A (en) Data compatibility method, device and equipment for APP version degradation and storage medium
CN111679835A (en) Application processing method, device, terminal and storage medium
CN112379943A (en) Plug-in application method and device of Electron application program and storage medium
CN112328287A (en) Embedded equipment system updating method, device, equipment and storage 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