Response event identification method and device, storage medium and electronic equipment

Through automated recognition methods, the response events of click locations are obtained, which solves the problem of cumbersome positioning of click location response events in mobile application development and testing, and significantly improves the inspection efficiency.

CN119759715APending Publication Date: 2025-04-04BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411777451.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

During the mobile application development and testing phase, the process of identifying the response events corresponding to the click location is cumbersome, which makes the troubleshooting abnormalities take a long time and inefficient.

Method used

By obtaining the position coordinates of the center point relative to the target application window view when the detection component of the target application is clicked, traversing all hierarchical views to obtain the set of views containing the coordinates, extracting the response events of each view, and generating and displaying the event list view.

Benefits of technology

It realizes the efficient correlation between click position and response events, adapts to complex view structure, significantly improves positioning efficiency, and accelerates abnormal inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759715A_ABST
    Figure CN119759715A_ABST
Patent Text Reader

Abstract

The invention relates to a response event identification method and device, a storage medium and electronic equipment. The method comprises the steps that under the condition that it is detected that a detection assembly of a target application is clicked, position coordinates of a center point of the detection assembly relative to a window view of the target application are acquired; traversing all hierarchical views of the target application by taking the window view of the target application as a bottom view according to the position coordinates of the central point of the detection component relative to the window view of the target application to obtain a view set; taking the last view in the view set as a top view, traversing all hierarchical views in the view set, and obtaining a response event of each view in the view set; and displaying a response event list view of the detection component, the response event list view including each view of the view set and the response event thereof. According to the method and the device, the technical problems of long time consumption and low efficiency of troubleshooting caused by a tedious process of identifying the response event corresponding to the click position are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, storage medium and electronic device for identifying a response event. Background Art

[0002] During the development and testing phase of mobile applications, we often encounter abnormal situations where clicking a certain location does not respond or the response event does not meet expectations. Such problems are usually caused by complex view hierarchies, event binding errors, or logical conflicts. In actual troubleshooting, testers generally tell developers the specific click location, and developers need to try to locate the view class and control view corresponding to the area based on the page layout and button information, and then find the response event bound to the control, and enter the specific implementation code of the response method to determine the cause of the problem. This process involves a large amount of work and complexity, especially in scenarios with many page hierarchies or complex view logic. Developers who are familiar with the current page code logic may complete the location quickly, but for maintainers or developers who are not familiar with the page, the search process usually takes a lot of time. In addition, some exceptions may involve interactions at multiple view levels, making troubleshooting more difficult. Although tools can be used to assist debugging in Debug mode (a running mode used for debugging and testing during software development), these tools can intuitively present the view structure and class name of the current click position, but they cannot be directly associated with the response event, which means that developers still need to manually find the response logic of the control binding and gradually analyze the relationship between hierarchical views. In summary, the relationship between locating the click position and the response event is complex, and it is necessary to find the view and logic layer by layer. It is difficult for debugging tools to intuitively display event binding, resulting in a long time-consuming and inefficient troubleshooting, which is especially difficult for unfamiliar developers. Summary of the invention

[0003] The present application provides a method, device, storage medium and electronic device for identifying a response event to solve the technical problem that the process of identifying a response event corresponding to a click position is cumbersome, resulting in a long time-consuming and inefficient abnormality detection.

[0004] In a first aspect, the present application provides a method for identifying a response event, comprising: when it is detected that a detection component of a target application is clicked, obtaining the position coordinates of the center point of the detection component relative to the window view of the target application; based on the position coordinates of the center point of the detection component relative to the window view of the target application, taking the window view of the target application as the bottom view, traversing all hierarchical views of the target application to obtain a view set, wherein the target view contains the position coordinates of the center point of the detection component relative to the target view, and the target view is any one of the views in the view set; taking the last view in the view set as the top view, traversing all hierarchical views of the view set to obtain the response event of each view in the view set; displaying the response event list view of the detection component, wherein the response event list view includes each view in the view set and its response event.

[0005] In a second aspect, the present application provides a response event identification device, including: a first acquisition module, used to obtain the position coordinates of the center point of the detection component relative to the window view of the target application when it is detected that the detection component of the target application is clicked; a second acquisition module, used to traverse all hierarchical views of the target application based on the position coordinates of the center point of the detection component relative to the window view of the target application, taking the window view of the target application as the bottom view, to obtain a view set, wherein the target view contains the position coordinates of the center point of the detection component relative to the target view, and the target view is any one of the views in the view set; a third acquisition module, used to traverse all hierarchical views of the view set with the last view in the view set as the top view, to obtain the response event of each view in the view set; a first display module, used to display the response event list view of the detection component, wherein the response event list view includes each view of the view set and its response event.

[0006] As an optional example, the apparatus further includes: a second display module for displaying the detection component at the target position of the target software when it is detected that the response event switch of the target software is turned on before the detection component of the target software is detected to be clicked.

[0007] As an optional example, the second acquisition module includes: a first execution unit, which is used to determine each level view of the target application as the current view starting from the bottom-level view, and perform the following operations on the current view: obtain all subviews of the current view; convert the position coordinates into target coordinates, wherein the target coordinates are the position coordinates of the detection component relative to the current view; when the target subview is a view that can respond to events and the target subview contains the target coordinates, add the target subview to the view set, wherein the target subview is any subview of the current view; determine the target subview as the next view of the current view.

[0008] As an optional example, the third acquisition module includes: a second execution unit, which is used to determine each view of the view collection as the current view starting from the top-level view, and perform the following operations on the current view: add the class name of the current view to the response event of the current view; determine whether the current view is a responsive interaction type; if the current view is a responsive interaction type, obtain all objects associated with the current view; add the name of each action event of non-empty objects among all objects associated with the current view to the response event of the current view; add the class name of the object that implements each action event to the response event of the current view.

[0009] As an optional example, the second execution unit is further used to, after determining whether the current view is a responsive interaction type, determine whether the current view is a gesture recognizer type if the current view is not a responsive interaction type; if the current view is a gesture recognizer type, obtain all gestures associated with the current view; add the name of each gesture event in each gesture associated with the current view to the response event of the current view; and add the class name of the object that implements each gesture event to the response event of the current view.

[0010] As an optional example, the second execution unit is further used to, after determining whether the current view is a gesture recognizer type, determine whether the current view is a custom type if the current view is not a gesture recognizer type; if the current view is a custom type, obtain the class to which the current view belongs and all its base classes along the inheritance chain; if the target class overrides the touch method, add the name of the target class to the response event of the current view, wherein the target class is the class to which the current view belongs and any one of its base classes along the inheritance chain; if the target class is a non-system class, add the name of the touch method implemented by the target class to the response event of the current view.

[0011] As an optional example, the second execution unit is further used to, after determining whether the current view is a custom type, determine whether the current view is the root view of the top-level view if the current view is not a custom type; if the current view is the root view of the top-level view, add the class name of the view controller instance of the current view to the response event of the current view; if the current view is not the root view of the top-level view, add the response event of the parent view of the current view to the response event of the current view.

[0012] In a third aspect, the present application provides a storage medium storing a computer program, wherein the computer program executes the above-mentioned response event identification method when executed by a processor.

[0013] In a fourth aspect, the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-mentioned method for identifying a response event through the computer program.

[0014] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:

[0015] The present application adopts the method of obtaining the position coordinates of the center point of the detection component relative to the window view of the target application when it is detected that the detection component of the target application is clicked; based on the position coordinates of the center point of the detection component relative to the window view of the target application, taking the window view of the target application as the bottom view, traversing all hierarchical views of the target application to obtain a view set, wherein the target view contains the position coordinates of the center point of the detection component relative to the target view, and the target view is any view in the view set; taking the last view in the view set as the top view, traversing all hierarchical views of the view set to obtain the response event of each view in the view set; and displaying the response event of the detection component. A component list view, wherein the above-mentioned response event list view includes each view of the above-mentioned view collection and its response event method. In the above-mentioned method, the click position and response event are quickly located in an automated manner. After detecting that the detection component is clicked, the global coordinates of its center point in the window view are obtained, and all hierarchical views are traversed to filter the view collection containing the coordinates. Then, the response event of each view in the view collection is extracted, and an event list view is generated and displayed to intuitively display the association between the view and the event, thereby realizing an efficient association between the click position and the response event, adapting to complex view structures, significantly improving positioning efficiency, and accelerating the purpose of abnormality troubleshooting, thereby solving the technical problem that the process of identifying the response event corresponding to the click position is cumbersome, resulting in a long time and low efficiency in abnormality troubleshooting. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0019] Figure 1 is a flowchart of an optional method for identifying a response event according to an embodiment of the present application;

[0020] Figure 2is a rendering of an optional method for identifying a response event according to an embodiment of the present application;

[0021] Figure 3 is a display schematic diagram of a response event switch according to an optional response event identification method of an embodiment of the present application;

[0022] Figure 4 is a schematic structural diagram of an optional response event identification device according to an embodiment of the present application;

[0023] Figure 5 is a schematic diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0025] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0026] According to a first aspect of an embodiment of the present application, a method for identifying a response event is provided. Optionally, as follows: Figure 1 As shown, the above method includes:

[0027] S102, when it is detected that the detection component of the target application is clicked, obtaining the position coordinates of the center point of the detection component relative to the window view of the target application;

[0028] S104, according to the position coordinates of the center point of the detection component relative to the window view of the target application, taking the window view of the target application as the bottom view, traversing all hierarchical views of the target application to obtain a view set, wherein the target view includes the position coordinates of the center point of the detection component relative to the target view, and the target view is any view in the view set;

[0029] S106, taking the last view in the view set as the top-level view, traversing all hierarchical views in the view set, and obtaining a response event of each view in the view set;

[0030] S108, displaying a response event list view of the detection component, wherein the response event list view includes each view of the view set and its response event.

[0031] Optionally, in the mobile application development and testing phase, the problem of no response to the location of the click or the response event not meeting expectations is often time-consuming and laborious. When troubleshooting, developers need to start with the click location provided by the test, and search for view classes, control views, and response events layer by layer. This process is exacerbated by the complexity of the view hierarchy, especially for developers who are not familiar with the page code logic. It is often difficult to locate the problem in time. Although the existing debugging tools can present the view structure and class name, they cannot directly display the response event binding information of the control, which increases the time cost and complexity of the troubleshooting. Therefore, in order to simplify this process and improve the positioning efficiency, in this embodiment, an automatic recognition method is introduced. The idea principle of this application is: a finger clicks the screen once, and a UITouch object is formed until it leaves and is destroyed. The UITouch object includes information such as the screen position touched by the current finger. The TouchPhase (stage describing the touch event) of the UITouch object saves the current state, including starting to touch, moving, keeping, leaving, and being cancelled. When the finger moves, the system updates the same UITouch object so that it can always save the touch position of the finger. When the finger leaves the screen, the system destroys the corresponding UITouch object. UIEvent represents an event in the system. An event contains one or more UITouch touch objects. There are four common types of UIEvent events: touch events (UIEventTypeTouches), motion events (UIEventTypeMotion), remote control events (UIEventTypeRemoteControl), and physical button events (UIEventTypePresses). The response event related to the touch position of this application is a touch event (UIEventTypeTouches). The entire cycle of an event includes the generation of an event, the transmission of an event, and the response of an event. The generation generally comes from user interaction, such as clicking. The transmission of events is forward, from the parent control to the child control until the visual top view view is found. The response to the event is reverse, passing along the responder chain. If the subview layer cannot respond, then the responder chain is used layer by layer to find the hierarchical control that can respond to handle the event. Event responder search stage (transfer chain): The view displayed on the screen by the APP is often a hierarchical tree with a relatively complex hierarchy. There is not only a parent-child structure relationship between views, but also a brother structure relationship. There may also be mutual coverage between brother nodes. The purpose of the event delivery chain is to find the last view in a complex view hierarchy, that is, to find the first view that can respond to the event.Event responder response event stage (responder chain): In the above search stage, the last view found by "hitTest:withEvent:" is naturally the first view that can respond to the event. When the view cannot handle the event, the system will continue to pass the event to the next responder through nextResponder. If there is no responder that can handle it, the event will be passed to UIApplication and finally abandoned. Therefore, the response chain is a series of connected responders, which starts with the first responder (First Response) and is continuously passed to UIApplication through nextResponder. In addition, in this responder chain structure composed of different objects, each object will get the opportunity to respond to the event in turn, but generally the first responder will handle the event. Based on the above principles, in this embodiment, when the detection component of the target application is clicked, the coordinates of its center point relative to the application window view are obtained. The center point of the detection component is also the touch point. The coordinates of the touch point are converted from the local to the global coordinate system to ensure that subsequent view traversal operations are performed based on a unified reference coordinate system. Starting from the window view of the target application, traverse all hierarchical views and check whether each view contains the coordinates of the center point of the detected component relative to the current view (judged by methods such as CGRectContainsPoint). Add views that meet the conditions to the view collection. This process can accurately filter out all views containing touch points, solving the problem of fuzzy point distribution in multi-level views. The last view in the view collection is used as the top-level view, because this view is usually the final target control or component clicked by the user. This step focuses on the most specific view where the touch point is located, eliminating interference from the upper parent view. Traverse all hierarchical views of the view collection, obtain the response events bound to each view, and realize direct mapping from controls to logic without the need for developers to manually search. Such as. Figure 2 The effect diagram shown presents all the above views and their corresponding response events in the response event list view. Developers can intuitively see all views related to the target point and their bound events, which greatly shortens the time to locate abnormal events.

[0032] Optionally, in this embodiment, the click position and response event are quickly located in an automated manner. After detecting that the detection component is clicked, the global coordinates of its center point in the window view are obtained, all hierarchical views are traversed to filter the view set containing the coordinates, and the last view is used as the top-level view. Then the response events of each view in the view set are extracted, including method binding and gesture callbacks, and an event list view is generated and displayed to intuitively display the association between the view and the event. It avoids the cumbersome process of traditional manual search, adapts to complex view structures, and significantly improves positioning efficiency. The response event list is easy to analyze, and even if the developer is not familiar with the code logic, the problem can be quickly located, reducing debugging time and maintenance costs.

[0033] As an optional example, before detecting that the detection component of the target software is clicked, the method further includes:

[0034] When it is detected that the response event switch of the target software is turned on, the detection component is displayed at the target position of the target software.

[0035] Optionally, in this embodiment, during the development and testing of mobile applications, in order to efficiently locate touch click problems, it is usually necessary to introduce auxiliary tools in Debug mode. The core of the above functions is to realize the dynamic display and hiding of the detection component by controlling the switch, so as to assist the developer in locating the touch area and its corresponding response event when necessary. Specifically, when running the target software, the system first detects whether the response event switch in Debug mode is turned on. The switch is turned off by default and is only turned on manually during testing or abnormal problem troubleshooting to avoid interference with regular development or testing processes. Figure 3 The display diagram of the response event switch shown in the figure shows that when the response event switch is detected to be turned on, the system will dynamically display the detection component at the target position. The component will move with the user's finger when dragged. The movable detection component will pop up the event list view when the user clicks it. The detection component is a transparent or clearly marked view, which is usually covered on the window view of the target application. Its position is consistent with the target touch area. The function of this component is to assist in capturing click events and subsequent logic. After being displayed, the detection component can capture user click operations in real time. Its coordinates and the coordinates of the touch point relative to the application window will serve as the basis for further positioning the view and response events, and provide a reference for subsequent click point analysis and event chain tracking. The display state of the detection component is completely controlled by the response event switch. After turning off the switch, the detection component will be hidden immediately and the normal operation state of the application will be restored. This dynamic mechanism makes this function more flexible and does not interfere with conventional development and testing.

[0036] As an optional example, according to the position coordinates of the center point of the detection component relative to the window view of the target application, the window view of the target application is used as the bottom view, and all hierarchical views of the target application are traversed to obtain the view collection including:

[0037] Starting from the bottom-level view, determine each view of the target application as the current view layer by layer, and perform the following operations on the current view:

[0038] Get all subviews of the current view;

[0039] When it is determined that the target subview is a view that can respond to the event, obtain the position coordinates of the center point of the detection component relative to the current view, convert the position coordinates of the center point of the detection component relative to the current view into the position coordinates of the center point of the detection component relative to the target subview, and when it is determined that the target subview contains the position coordinates of the center point of the detection component relative to the target subview, add the target subview to the view collection, wherein the target subview is any subview of the current view;

[0040] Determines the target subview as the next view of the current view.

[0041] Optionally, in this embodiment, in order to efficiently and accurately obtain the view set in which the center point of the detection component falls, the algorithm is implemented based on a recursive traversal of the hierarchical view. Specifically, the center point position of the detection component is used to obtain its coordinate position relative to the target application window view, and the target application window view is used as the starting point of the traversal (bottom-level view), and is used as the reference frame of the coordinate system. Starting from the bottom-level view, each view of the target application is determined as the current view, and the following operations are performed:

[0042] (1) Get the subview collection of the current view to prepare for subsequent coordinate judgment and recursive traversal.

[0043] (2) Check whether the subviews can respond to events. For each subview, check the following conditions: whether it is hidden, whether user interaction is prohibited, and whether the transparency is too low. Only subviews that meet the interaction conditions (not hidden, user interaction is not prohibited, and the transparency is high enough) are processed to the next step.

[0044] (3) Coordinate point conversion and view inclusion judgment: Convert the coordinates of the touch point to the coordinate system position of the current subview, use the CGRectContainsPoint function to determine whether the center point of the detection component is contained in the CGRect of the current subview. If it is contained, determine that the subview contains the position coordinates of the touch point relative to the view, and add the subview to the view collection.

[0045] (4) If the subview contains a touch point, the algorithm is recursively called with the subview as the current view, and the subview hierarchy of the view is checked and processed in the same way. All subviews that meet the conditions are recursively parsed and added to the view collection.

[0046] After the traversal is completed, the accumulated view collection is returned, which contains all views from the top layer to the bottom layer that can respond to the touch points of the detection component.

[0047] Optionally, in this embodiment, by recursively acquiring the view set that the touch point falls into, the algorithm achieves efficient parsing of complex view hierarchies, significantly improves development and testing efficiency, and reduces debugging complexity.

[0048] As an optional example, take the last view in the view collection as the top-level view, traverse all hierarchical views of the view collection, and obtain the response events of each view in the view collection, including:

[0049] Starting from the top-level view, each view in the view collection is determined as the current view layer by layer, and the following operations are performed on the current view:

[0050] Add the class name of the current view to the response event of the current view;

[0051] Determine whether the current view is a responsive interaction type;

[0052] If the current view is a responsive interaction type, get all objects associated with the current view;

[0053] Add the name of each action event of all non-null objects associated with the current view to the response event of the current view;

[0054] Add the class name of the object that implements each action event to the response event of the current view.

[0055] Optionally, in this embodiment, in order to efficiently parse the response events involved in the touch point, the algorithm starts from the top-level view of the view collection and recurses to the parent view step by step, and completely records the class name of the view component and its related response events. Specifically, starting from the last view in the view collection (the visual top view), take it as the vertex of the recursion, and perform the following operations on each view level by level: call the class name of the current view and add it to the global variable string as part of the recursive path record; check whether the current view is an interactive type (such as UIControl type). If it is not an interactive type, continue to process the parent view without further checking. If it is an interactive type, perform the following operations to obtain its associated response events: call the system API allTargets to obtain all target objects associated with the current view. These target objects are the recipients of the action message. For each target object, determine whether the target object is empty: if it is empty, skip the processing of the current object; if it is not empty, continue processing, and call the "actionsForTarget:forControlEvent:" method to obtain a collection of all action event names associated with the target object. Traverse the action event collection, obtain the name of the current action event and the class name of the object implementing the action event one by one, record the action event name and the class name of its implementation object into a global variable string, and complete the response event recording of the current view. After processing the current view, set its parent view as the current view, and recursively call the same logic until all hierarchical views are traversed or there is no parent view to recurse.

[0056] Optionally, in this embodiment, by recursively recording class names and response events from the top-level view to the parent view level by level, the algorithm achieves efficient positioning of complex view interaction problems, providing strong technical support for development and testing work. The algorithm can record the complete path from the top-level view to all parent views, including the class name of each level of view and its response event, forming a clear event chain tracking. Through detailed response event records, developers can quickly locate the source of interaction anomalies, especially in complex view hierarchies, which significantly improves debugging efficiency. Automatically record the response event chain, eliminating the need for developers to manually search and verify each view, effectively reducing debugging time and the probability of human error.

[0057] As an optional example, after determining whether the current view is a responsive interaction type, the method further includes:

[0058] If the current view is not a responsive interaction type, determine whether the current view is a gesture recognizer type;

[0059] If the current view is a gesture recognizer type, get all gestures associated with the current view;

[0060] Add the name of each gesture event in each gesture associated with the current view to the response event of the current view;

[0061] Add the class name of the object that implements each gesture event to the response event of the current view.

[0062] Optionally, in this embodiment, in complex interactive scenarios, only judging whether the view is of an interactive type may not be sufficient to cover all response events, especially gesture events. To this end, the view type judgment logic is extended, and the processing of gesture recognizer (Gesture Recognizer) type views is added to ensure that all possible events in the response chain are fully captured. Specifically, after confirming that the current view is not an interactive type view, it is further determined whether it is a gesture recognizer type, and whether it is a gesture recognizer (such as a UIGestureRecognizer subclass) is confirmed by type matching. Each gesture recognizer can contain one or more target objects and their corresponding action events. The target array of the gesture is accessed using the interface provided by the system private class UIGestureRecognizerTarget. For each target object in the array, the method name corresponding to the current gesture event and the class name that implements the gesture event are obtained. The obtained class name and method name are recorded in a global variable string as part of the response event of the current view. After completing the above processing for all gesture recognizers, the parent view is recursively continued to ensure that all gesture events and response chains in the view hierarchy are captured. Adding processing for gesture recognizers supplements the deficiencies of traditional interaction type view judgment and ensures that no gesture events in the response chain are missed. Gesture events are often used in complex interactions (such as zooming, dragging, sliding, etc.). After adding this judgment logic, gesture event triggering anomalies and conflict causes can be quickly located.

[0063] Optionally, in this embodiment, by further judging and processing the gesture recognizer type view, the completeness and accuracy of response event capture are improved, providing strong support for debugging work in complex interaction scenarios.

[0064] As an optional example, after determining whether the current view is a gesture recognizer type, the method further includes:

[0065] If the current view is not a gesture recognizer type, determine whether the current view is a custom type;

[0066] When the current view is of a custom type, get the class to which the current view belongs and all its base classes along the inheritance chain;

[0067] In the case where the target class overrides the touch method, the name of the target class is added to the response event of the current view, where the target class is the class to which the current view belongs and any of its base classes along the inheritance chain;

[0068] When the target class is a non-system class, the name of the touch method implemented by the target class is added to the response event of the current view.

[0069] Optionally, in touch event processing, in addition to the interactive type controls and gesture recognizers provided by the system, the custom view may implement custom interaction logic by overriding touch methods (such as touchesBegan:withEvent:). In order to capture this type of event response mechanism, in this embodiment, when the current view is neither an interactive type view nor a gesture recognizer type, it is further determined whether it is a custom type view, and whether the class of the current view and all its base classes along the inheritance chain have overridden any of the following touch methods: "touchesBegan:withEvent:", "touchesMoved:withEvent:", "touchesEnded:withEvent:", "touchesCancelled:withEvent:". Traverse the class to which the current view belongs and all its base classes in the inheritance chain, check whether each class implements the above touch methods, if a class that implements any method is found, use the class name as the target class, and confirm whether the target class is a system class. System classes (such as UIView, UIButton, etc.) usually do not need to be recorded. If the target class is a non-system class (custom class), further processing is performed. Record the target class name and the name of the touch method it implements (one or more) into a global mutable string as part of the response event of the current view. After completing the processing of the custom event of the current view, continue to recurse the parent view or ancestor view to ensure that all custom events in the entire view hierarchy are captured. The touch method of a custom view is an important way for developers to achieve unique interactions. This method supplements the ability to capture custom touch logic and covers the complete event response chain. Custom touch logic is usually accompanied by complex functions (such as drawing, dragging, gesture conflict handling, etc.). Capturing these custom events makes it easier for developers to locate the source of the problem and optimize the interaction logic. Through the recursive inheritance chain, the specific class that overrides the touch method can be accurately located to avoid missed reports or false positives. At the same time, the class name and method name that implement the event logic are clearly defined to provide a clear basis for problem analysis.

[0070] As an optional example, after determining whether the current view is of a custom type, the method further includes:

[0071] If the current view is not of a custom type, determine whether the current view is the root view of the top-level view;

[0072] When the current view is the root view of the top-level view, add the class name of the view controller instance of the current view to the response event of the current view;

[0073] When the current view is not the root view of the top-level view, the response event of the parent view of the current view is added to the response event of the current view.

[0074] Optionally, in the recursive processing of the view event response chain, considering the hierarchical structure of the view and the propagation mechanism of the event, a judgment and processing mechanism for the root view of the top-level visible window view is further introduced to ensure that the complete view and controller logic are covered. In this embodiment, if the current view is neither a custom type view nor an interactive control logic or gesture recognition logic is implemented, it is continued to determine whether it is the root view of the top-level visible window, and check whether the current view is the root node of the subview tree of the top-level visible window view. When the current view is the root view, the root view is usually bound to a view controller instance, and the bound view controller instance is obtained using the system API, and the class name of the view controller instance is extracted, and the class name is recorded in a global variable string as part of the response event of the current view. When the current view is not the root view, the response event of the parent view of the current view is obtained by recursively calling the "getActionInView:" method, including the event class name and method name implemented by it, and these parent view response events are recorded in a global variable string and associated with the response event of the current view. If the current view is not the root view of the top-level view, the response event of the parent view is obtained recursively upward layer by layer until the root view or other interrupt conditions are reached to ensure that the event propagation chain is fully recorded. By recording the controller class name of the root view of the top-level visible window view, the view event and controller logic are associated, which helps to analyze the controller-level behavior during interface jumps or event distribution. When the current view has no direct event response, the response event of the parent view is obtained recursively to ensure the integrity and continuity of the event propagation chain, especially in a complex view hierarchy, so that the complete propagation path of the event from the root view to the target view can be clearly defined.

[0075] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0076] According to another aspect of the embodiment of the present application, a device for identifying a response event is also provided. Figure 4 As shown, including:

[0077] A first acquisition module 402 is used to acquire the position coordinates of the center point of the detection component relative to the window view of the target application when it is detected that the detection component of the target application is clicked;

[0078] The second acquisition module 404 is used to traverse all hierarchical views of the target application according to the position coordinates of the center point of the detection component relative to the window view of the target application, taking the window view of the target application as the bottom view, and acquire a view set, wherein the target view includes the position coordinates of the center point of the detection component relative to the target view, and the target view is any view in the view set;

[0079] The third acquisition module 406 is used to take the last view in the view set as the top-level view, traverse all hierarchical views in the view set, and acquire the response event of each view in the view set;

[0080] The first display module 408 is used to display the response event list view of the detection component, wherein the response event list view includes each view of the view set and its response event.

[0081] It should be noted that the first acquisition module 402 in this embodiment can be used to execute step S102 in the embodiment of the present application, the second acquisition module 404 in this embodiment can be used to execute step S104 in the embodiment of the present application, the third acquisition module 406 in this embodiment can be used to execute step S106 in the embodiment of the present application, and the first display module 408 in this embodiment can be used to execute step S108 in the embodiment of the present application.

[0082] As an optional example, the above device further includes:

[0083] The second display module is used to display the detection component at the target position of the target software before detecting that the detection component of the target software is clicked and when detecting that the response event switch of the target software is turned on.

[0084] As an optional example, the second acquisition module includes:

[0085] The first execution unit is used to determine each level view of the target application as the current view starting from the bottom level view, and perform the following operations on the current view:

[0086] Get all subviews of the current view;

[0087] Convert the position coordinates to target coordinates, where the target coordinates are the position coordinates of the detection component relative to the current view;

[0088] When the target subview is a view that can respond to events and contains target coordinates, add the target subview to the view collection, wherein the target subview is any subview of the current view;

[0089] Determines the target subview as the next view of the current view.

[0090] As an optional example, the third acquisition module includes:

[0091] The second execution unit is used to determine each view in the view set as the current view starting from the top-level view, and perform the following operations on the current view:

[0092] Add the class name of the current view to the response event of the current view; determine whether the current view is a responsive interaction type;

[0093] If the current view is a responsive interaction type, get all objects associated with the current view;

[0094] Add the name of each action event of all non-null objects associated with the current view to the response event of the current view;

[0095] Add the class name of the object that implements each action event to the response event of the current view.

[0096] As an optional example, the second execution unit is further configured to, after determining whether the current view is of a responsive interaction type, determine whether the current view is of a gesture recognizer type if the current view is not of a responsive interaction type;

[0097] When the current view is a gesture recognizer type, obtain all gestures associated with the current view; add the name of each gesture event in each gesture associated with the current view to the response event of the current view;

[0098] Add the class name of the object that implements each gesture event to the response event of the current view.

[0099] As an optional example, the second execution unit is further configured to, after determining whether the current view is of a gesture recognizer type, determine whether the current view is of a custom type if the current view is not of a gesture recognizer type;

[0100] When the current view is of a custom type, get the class to which the current view belongs and all its base classes along the inheritance chain;

[0101] In the case where the target class overrides the touch method, the name of the target class is added to the response event of the current view, where the target class is the class to which the current view belongs and any of its base classes along the inheritance chain;

[0102] When the target class is a non-system class, the name of the touch method implemented by the target class is added to the response event of the current view.

[0103] As an optional example, the second execution unit is further configured to, after determining whether the current view is of a custom type, determine whether the current view is a root view of a top-level view if the current view is not of a custom type;

[0104] When the current view is the root view of the top-level view, add the class name of the view controller instance of the current view to the response event of the current view;

[0105] When the current view is not the root view of the top-level view, the response event of the parent view of the current view is added to the response event of the current view.

[0106] For other examples of this embodiment, please refer to the above examples and will not be repeated here.

[0107] Figure 5 is a schematic diagram of an optional electronic device according to an embodiment of the present application, such as Figure 5 As shown, it includes a processor 502, a communication interface 504, a memory 506 and a communication bus 508, wherein the processor 502, the communication interface 504 and the memory 506 communicate with each other through the communication bus 508, wherein,

[0108] Memory 506, used for storing computer programs;

[0109] The processor 502 is used to execute the computer program stored in the memory 506 to implement the following steps:

[0110] When it is detected that the detection component of the target application is clicked, obtaining the position coordinates of the center point of the detection component relative to the window view of the target application;

[0111] According to the position coordinates of the center point of the detection component relative to the window view of the target application, taking the window view of the target application as the underlying view, traverse all hierarchical views of the target application to obtain a view set, wherein the target view contains the position coordinates of the center point of the detection component relative to the target view, and the target view is any view in the view set;

[0112] Take the last view in the view collection as the top-level view, traverse all hierarchical views in the view collection, and obtain the response event of each view in the view collection;

[0113] The response event list view of the detection component is displayed, wherein the response event list view includes each view of the view set and its response event.

[0114] Optionally, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The communication interface is used for communication between the above electronic device and other devices.

[0115] The memory may include RAM, or may include non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0116] As an example, the memory 506 may include, but is not limited to, the first acquisition module 402, the second acquisition module 404, the third acquisition module 406, and the first display module 408 in the above-mentioned response event recognition device. In addition, it may also include, but is not limited to, other module units in the above-mentioned response event recognition device, which will not be repeated in this example.

[0117] The above-mentioned processor can be a general-purpose processor, which can include but not be limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0118] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0119] It can be understood by those skilled in the art that Figure 5The structure shown is for illustration only. The device for implementing the above-mentioned response event identification method may be a terminal device, which may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 5 The structure of the electronic device is not limited. For example, the electronic device may also include Figure 5 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 5 Different configurations shown.

[0120] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.

[0121] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program executes the steps in the above-mentioned response event identification method when executed by a processor.

[0122] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0123] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0124] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0125] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0126] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0127] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0128] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0129] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for identifying a response event, characterized in that: include: When it is detected that the detection component of the target application is clicked, obtaining the position coordinates of the center point of the detection component relative to the window view of the target application; According to the position coordinates of the center point of the detection component relative to the window view of the target application, taking the window view of the target application as the bottom view, traverse all hierarchical views of the target application to obtain a view set, wherein the target view contains the position coordinates of the center point of the detection component relative to the target view, and the target view is any view in the view set; Taking the last view in the view set as the top-level view, traverse all hierarchical views of the view set, and obtain the response event of each view in the view set; The response event list view of the detection component is displayed, wherein the response event list view includes each view of the view set and its response event.

2. The method according to claim 1, characterized in that Before detecting that the detection component of the target software is clicked, the method further includes: In the case where it is detected that the response event switch of the target software is turned on, the detection component is displayed at the target position of the target software.

3. The method according to claim 1, characterized in that The acquiring of the view set comprises: according to the position coordinates of the center point of the detection component relative to the window view of the target application, taking the window view of the target application as the bottom view, traversing all hierarchical views of the target application, and comprising: Starting from the bottom view, each view of the target application is determined as the current view layer by layer, and the following operations are performed on the current view: Get all subviews of the current view; When it is determined that the target subview is a view that can respond to events, obtain the position coordinates of the center point of the detection component relative to the current view, convert the position coordinates of the center point of the detection component relative to the current view into the position coordinates of the center point of the detection component relative to the target subview, and when it is determined that the target subview contains the position coordinates of the center point of the detection component relative to the target subview, add the target subview to the view set, wherein the target subview is any subview of the current view; The target subview is determined as a next view of the current view.

4. The method according to claim 1, characterized in that: The step of taking the last view in the view set as the top-level view, traversing all hierarchical views in the view set, and obtaining a response event of each view in the view set includes: Starting from the top-level view, each view in the view set is determined as the current view layer by layer, and the following operations are performed on the current view: Add the class name of the current view to the response event of the current view; Determine whether the current view is a responsive interaction type; In the case where the current view is of a responsive interaction type, obtaining all objects associated with the current view; Add the name of each action event of non-empty objects in all objects associated with the current view to the response event of the current view; The class name of the object that implements each action event is added to the response event of the current view.

5. The method according to claim 4, characterized in that After determining whether the current view is of a responsive interaction type, the method further includes: In the case that the current view is not of a responsive interaction type, determining whether the current view is of a gesture recognizer type; In the case where the current view is a gesture recognizer type, obtaining all gestures associated with the current view; Add the name of each gesture event in each gesture associated with the current view to the response event of the current view; The class name of the object that implements each gesture event is added to the response event of the current view.

6. The method according to claim 5, characterized in that After determining whether the current view is a gesture recognizer type, the method further includes: If the current view is not of a gesture recognizer type, determining whether the current view is of a custom type; In the case that the current view is of a custom type, obtaining the class to which the current view belongs and all its base classes along the inheritance chain; In the case where the target class overrides the touch method, the name of the target class is added to the response event of the current view, wherein the target class is any class of the class to which the current view belongs and all its base classes along the inheritance chain; In the case that the target class is a non-system class, the name of the touch method implemented by the target class is added to the response event of the current view.

7. The method according to claim 6, characterized in that After determining whether the current view is of a user-defined type, the method further includes: When the current view is not of a custom type, determining whether the current view is a root view of the top-level view; In the case where the current view is the root view of the top-level view, adding the class name of the view controller instance of the current view to the response event of the current view; When the current view is not the root view of the top-level view, the response event of the parent view of the current view is added to the response event of the current view.

8. A device for identifying a response event, characterized in that: include: A first acquisition module is used to acquire the position coordinates of the center point of the detection component relative to the window view of the target application when it is detected that the detection component of the target application is clicked; A second acquisition module is used to traverse all hierarchical views of the target application according to the position coordinates of the center point of the detection component relative to the window view of the target application, taking the window view of the target application as the underlying view, and acquire a view set, wherein the target view contains the position coordinates of the center point of the detection component relative to the target view, and the target view is any view in the view set; A third acquisition module is used to take the last view in the view set as the top-level view, traverse all hierarchical views of the view set, and acquire a response event of each view in the view set; The first display module is used to display a response event list view of the detection component, wherein the response event list view includes each view of the view set and its response event.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.