{"id":344676,"date":"2023-01-30T15:00:19","date_gmt":"2023-01-30T15:00:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=344676"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=344676","title":{"rendered":"<span>\u041f\u043e\u0438\u0441\u043a callback-\u043e\u0432 \u043a\u043d\u043e\u043f\u043e\u043a \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435 iOS<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041e\u0441\u043d\u043e\u0432\u043e\u0439 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u0430\u043c, \u0442\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0441\u0430\u043c\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u043f\u0440\u044f\u043c\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0443\u0436\u0435 \u0441\u043e\u0431\u0440\u0430\u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043b\u043e\u0433\u0438\u043a\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0440\u0435\u0432\u0435\u0440\u0441\u0443.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 callback \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 iOS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/frida.re\/\" rel=\"nofollow noopener noreferrer\">frida<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u044f \u0434\u0443\u043c\u0430\u044e \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0442\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0430 iOS \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043d\u0443\u0440\u044f\u043d\u043a\u0430 cllaback-\u043e\u0432 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0435\u0442\u0435\u0440\u043f\u0435\u043b\u0438\u0432\u044b\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/github.com\/chepaika\/frida-ios-clicklog\" rel=\"nofollow noopener noreferrer\">\u0442\u0443\u0442<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"v-chem-sobstvenno-problema\">\u0412 \u0447\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043e\u0434\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0442\u0440\u0443\u0434\u0430 \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">ObjC.classes.UIWindow.keyWindow().recursiveDescription().toString()<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">\"&lt;UIWindow: 0x10110b250; frame = (0 0; 667 375); gestureRecognizers = &lt;NSArray: 0x2832b58c0>; layer = &lt;UIWindowLayer: 0x283c83dc0>>   | &lt;UITransitionView: 0x10110d150; frame = (0 0; 667 375); autoresize = W+H; layer = &lt;CALayer: 0x283c83220>>   |    | &lt;UIDropShadowView: 0x10110e780; frame = (0 0; 667 375); autoresize = W+H; layer = &lt;CALayer: 0x283c812a0>>   |    |    | &lt;UIView: 0x10110b050; frame = (0 0; 667 375); autoresize = W+H; layer = &lt;CALayer: 0x283c816e0>>   |    |    |    | &lt;UIButton: 0x10110b540; frame = (250 171; 62 33); opaque = NO; autoresize = RM+BM; layer = &lt;CALayer: 0x283c83fa0>>   |    |    |    |    | &lt;UIButtonLabel: 0x101117e00; frame = (0 6; 62 21); text = 'Test'; opaque = NO; userInteractionEnabled = NO; layer = &lt;_UILabelLayer: 0x281f8c0a0>>\"<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0443\u0434\u0430 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u043d\u0443\u0436\u043d\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 (0x10110b540) \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">var button = new ObjC.Object(new NativePointer(\"0x10110b540\")) button._allTargetActions().toString()<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">\"(    \\\"&lt;UIControlTargetAction: 0x2832b6fd0> actionHandler=&lt;_UIImmutableAction: 0x281891860; title = > events=0x40\\\",    \\\"&lt;UIControlTargetAction: 0x2832b6f70> target=0x10110a9d0 action=click1 events=0x40\\\",    \\\"&lt;UIControlTargetAction: 0x2832b6f40> target=0x0 action=click2 events=0x40\\\" )\"<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0438\u043c\u0435\u043d\u0430 \u0434\u0432\u0443\u0445 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u2014 <code>click1<\/code> \u0438 <code>click2<\/code>, \u0430 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u2014 \u043f\u043e\u043b\u0435 <code>target<\/code> \u2014 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u0442\u044c \u0447\u0442\u043e \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c \u0432 IDA \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c \u0433\u0434\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0441\u0446\u0435\u043d\u044b \u0438 \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 <code>keyWindow().recursiveDescription()<\/code> \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 30 \u043a\u043d\u043e\u043f\u043e\u043a. \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0431\u043e\u0433\u0430\u0442\u0441\u0442\u0432\u043e\u043c \u0440\u0443\u043a\u0430\u043c\u0438 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044f, \u0430 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430\u0436\u0430\u0442\u0438\u0439 \u0432 iOS.<\/p>\n<p>  <\/p>\n<h2 id=\"uievent\">UIEvent<\/h2>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <code>UIEvent<\/code>. \u0412 \u0446\u0435\u043b\u043e\u043c \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0435\u0441\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 (<a href=\"https:\/\/habr.com\/ru\/post\/584100\/\">\u0442\u044b\u0446<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/post\/464463\/\">\u0442\u044b\u0446<\/a>), \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0449\u0435 <a href=\"https:\/\/medium.com\/ios-os-x-development\/understanding-cocoa-and-cocoa-touch-responder-chain-12fe558ebe97\" rel=\"nofollow noopener noreferrer\">\u044d\u0442\u0443<\/a> \u0441\u0442\u0430\u044c\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u0440\u0430\u0437\u0431\u0435\u0440\u043c \u043a\u0440\u0430\u0442\u043a\u043e.<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <code>UIKit<\/code>, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u041e\u0421 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 <code>UIEvent<\/code> \u0438 \u043a\u043b\u0430\u0434\u0435\u0442 \u0435\u0433\u043e \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0439 <code>UIApplication<\/code>. \u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0442\u0440\u044f\u0441\u0435\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\/\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u0430\u043b \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443\/\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043e\u0442 \u043d\u0430\u0443\u0448\u043d\u0438\u043a\u043e\u0432). \u0414\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430.<\/li>\n<li><code>UIApplication<\/code> \u0434\u043e\u0441\u0442\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 \u2014 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043e\u043a\u043d\u043e (<code>UIWindow<\/code>)<\/li>\n<li><code>UIWindow<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiview\/1622469-hittest\" rel=\"nofollow noopener noreferrer\">hitTest(_:with:)<\/a> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0430\u043c\u043e\u0435 \u0432\u0435\u0440\u0445\u043d\u0435\u0435 <code>UIView<\/code> \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043a\u0430\u0441\u0430\u043d\u0438\u0435<\/li>\n<li>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0432\u044c\u044e\u0448\u043a\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0438 \u0443 \u043d\u0435\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043a\u0430\u0441\u0430\u043d\u0438\u044f.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043b\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0438 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u0432\u0441\u0435 <code>UIView<\/code> \u0440\u0430\u0432\u043d\u043e \u043a\u0430\u043a \u0438 <code>UIWindow<\/code> \u0438 <code>UIApplication<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiresponder\" rel=\"nofollow noopener noreferrer\">UIResponder<\/a> \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 <code>UIEvent<\/code> \u2014 \u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0432\u043e\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043e\u0434\u0438\u043d \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 UIResponder-\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">func touchesBegan(_ touches: Set&lt;UITouch>, with event: UIEvent?) func touchesMoved(_ touches: Set&lt;UITouch>, with event: UIEvent?) func touchesEnded(_ touches: Set&lt;UITouch>, with event: UIEvent?) func touchesCancelled(_ touches: Set&lt;UITouch>, with event: UIEvent?)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443 \u043f\u0435\u0440\u0432\u043e\u0433\u043e <code>UIResponder<\/code> \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f:<\/p>\n<p>  <\/p>\n<p>1) \u0412\u044b\u0437\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435<br \/>  2) \u041f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435<br \/>  3) \u041f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0446\u0435\u043f\u043e\u0447\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432:<\/p>\n<p>  <\/p>\n<p>1) \u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0440\u0430\u043d\u0435\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>hitTest(_:with:)<\/code> \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0439 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0432\u044c\u044e\u0448\u043a\u043e\u0439 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u0435<br \/>  2) \u041e\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0435\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 <code>UIView<\/code> \u2014 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiview\/1622474-superview\" rel=\"nofollow noopener noreferrer\">superview<\/a><br \/>  3) \u0428\u0430\u0433 <strong>2<\/strong> \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043a\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435 \u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043e <code>ViewController<\/code>-\u0430<br \/>  4) \u0414\u0430\u043b\u044c\u0448\u0435 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f <code>ViewController<\/code>-\u044b \u043f\u043e\u043a\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435 \u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043e root-\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<br \/>  5) \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f <code>UIWindow<\/code><br \/>  6) \u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>AppDelegate<\/code><br \/>  7) \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f<\/p>\n<p>  <\/p>\n<h2 id=\"uicontrol\">UIControl<\/h2>\n<p>  <\/p>\n<p>\u0418 \u0442\u0430\u043a <code>UIEvent<\/code> \u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0438 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043e\u0434\u043d\u0430\u043a\u043e callback \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uicontrol\/1618259-addtarget\" rel=\"nofollow noopener noreferrer\">addTarget(_:action:for:)<\/a> \u043b\u0438\u0431\u043e <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uicontrol\/3600490-addaction\" rel=\"nofollow noopener noreferrer\">addAction(_:for:)<\/a> \u043e\u0431\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u044c\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0443 <code>UIControl<\/code> \u0438 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u043c\u0438\u043c\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0442\u0438\u043f\u0430 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uicontrol\/event\" rel=\"nofollow noopener noreferrer\">UIControl.Event<\/a> \u0430 \u043d\u0435 <code>UIEvent<\/code>.<\/p>\n<p>  <\/p>\n<p><code>addTarget<\/code> \u043a\u0440\u043e\u043c\u0435 <code>UIControl.Event<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0435\u0449\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c <code>target<\/code> \u2014 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0433\u043e callback \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0435\u0449\u0435 \u0438 <code>null<\/code> \u0438 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u044a <code>addTarget<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <code>UIControlTargetAction<\/code> \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u043f\u043e\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c <\/p>\n<p>  <\/p>\n<ul>\n<li><code>UIControlTargetAction._target = target<\/code><\/li>\n<li><code>UIControlTargetAction._action = action<\/code><\/li>\n<li><code>UIControlTargetAction._eventMask = controlEvents<\/code> <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c <code>addTarget<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <code>UIControl._addControlTargetAction<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 <code>UIControl._targetActions<\/code> \u0438 \u0435\u0441\u043b\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 <code>UIControlTargetAction<\/code> \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435 \u043f\u043e\u043b\u044f\u043c\u0438 <code>target<\/code> \u0438 <code>_action<\/code> \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0435\u0433\u043e \u043f\u043e\u043b\u0435 <code>_eventMask<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043c\u0430\u0441\u043a\u0438 \u043d\u043e\u0432\u043e\u0433\u043e <code>UIControlTargetAction<\/code> (\u0447\u0442\u043e\u0431\u044b \u043e\u0434\u0438\u043d callback \u043c\u043e\u0433 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438), \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 <code>UIControlTargetAction<\/code> \u0432 \u043c\u0430\u0441\u0441\u0438\u0432.<\/p>\n<p>  <\/p>\n<p><code>addAction(_:for:)<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 14 iOS \u0438 \u0438\u043c\u0435\u0435\u0442 \u0441\u0445\u043e\u0436\u0443 \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 <code>addTarget<\/code> \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u043b\u0435\u0439 <code>_target<\/code> \u0438 <code>_action<\/code> \u0443 \u043e\u0431\u044c\u0435\u043a\u0442\u0430 <code>UIControlTargetAction<\/code> \u0437\u0430\u043f\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0435 <code>_actionHandler<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u0430 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiaction\" rel=\"nofollow noopener noreferrer\">UIAction<\/a>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/qq\/8l\/yd\/qq8lydnshd3cba8xiubr4qwefcg.png\" alt=\"UIControl_add\" data-src=\"https:\/\/habrastorage.org\/webt\/qq\/8l\/yd\/qq8lydnshd3cba8xiubr4qwefcg.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0432\u043e\u0442 \u043e\u0442 <code>UIKit<\/code> \u0443 \u043d\u0430\u0441 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 <code>UIEvent<\/code>-\u044b, \u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u044b \u0432\u0435\u0448\u0430\u0435\u043c \u0443\u0436\u0435 \u043d\u0430 <code>UIControl.Event<\/code>. \u041d\u0435\u0441\u0442\u044b\u043a\u043e\u0432\u043e\u0447\u043a\u0430 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e. \u041b\u043e\u0433\u0438\u043a\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e <code>UIControl<\/code> \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>UIResponder<\/code>-\u043e\u043c \u0438 \u0442\u0430\u043a\u0438 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 <code>UIEvent<\/code>-\u043e\u0432. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0436 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0434\u0438\u0437\u0430\u0441\u043c <code>UIControl.touchesEnded<\/code>. \u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0435? \u0414\u0430 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043d\u043e\u043f\u043a\u0438 \u0432\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>UIControl.Event.touchUpInside<\/code> \u2014 \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0434\u043d\u044f\u043b \u043f\u0430\u043b\u0435\u0446 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f, \u0447\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u044f\u0436\u0435\u0442\u0441\u044f \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/go\/0e\/hx\/go0ehxefrix5cedy2dklxgbx0rq.png\" alt=\"touchesEnded\" data-src=\"https:\/\/habrastorage.org\/webt\/go\/0e\/hx\/go0ehxefrix5cedy2dklxgbx0rq.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0434\u0438\u0437\u0430\u0441\u043c\u0430, \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>UIControl._sendActionsForEvents(_:UIEvent, withEvent: UIControl.Event)<\/code> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c\u0438 <code>UIControl.Event<\/code>-\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">touchDragEnter =    1 &lt;&lt;  4 = 16 touchDragExit =     1 &lt;&lt;  5 = 32 touchUpInside =     1 &lt;&lt;  6 = 64 touchUpOutside =    1 &lt;&lt;  7 = 128<\/code><\/pre>\n<p>  <\/p>\n<p><code>_sendActionsForEvents<\/code> \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 <code>UIControlTargetAction<\/code> \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u043e\u0442 \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u0430\u0441\u043a\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c <code>UIControl.Event<\/code> -\u043e\u043c, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043b\u043e\u0433\u0438\u043a\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043b\u0438 <code>_actionHandler<\/code> \u0438\u043b\u0438 \u043f\u043e\u043b\u0435 <code>_action<\/code>.<\/p>\n<p>  <\/p>\n<h3 id=\"_action\">_action<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d <code>_action<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uicontrol\/1618237-sendaction\" rel=\"nofollow noopener noreferrer\">UIControl.sendAction(_:to:for:)<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0430\u0435\u0442 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d UIApplication \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiapplication\/1622946-sendaction\" rel=\"nofollow noopener noreferrer\">UIApplication.sendAction(_:to:from:for:)<\/a>, \u043a\u0443\u0434\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <code>sender<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0441\u0435\u0431\u044f.<\/p>\n<p>  <\/p>\n<p><code>UIApplication.sendAction<\/code> \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0435 <code>null<\/code> \u043b\u0438 \u0442\u0430\u0440\u0433\u0435\u0442 \u0438 \u0435\u0441\u043b\u0438 <code>null<\/code> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 <code>UIApplication._targetInChainForAction(_:Selector, sender: Any) -> Any?<\/code> \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e (\u0441\u044e\u0440\u043f\u0440\u0438\u0437) <code>UIResponder<\/code>, \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u2014 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u2014 \u043f\u0435\u0440\u0432\u044b\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u0439 \u043d\u0438\u0436\u043d\u0438\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043b\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e <code>UIApplication.sendAction<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443\u0436\u0435 \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiresponder\/1621146-target\" rel=\"nofollow noopener noreferrer\">UIResponder.target(forAction:withSender:)<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0432\u0435\u0440\u0445 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 <code>UIResponder<\/code> \u2014 \u043e\u0432<br \/>  \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiresponder\/1621105-canperformaction\" rel=\"nofollow noopener noreferrer\">UIResponder.canPerformAction(_:withSender:)<\/a> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 <code>UIResponder<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b\u0439 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u0438 \u0435\u0441\u043b\u0438 \u043c\u043e\u0436\u0435\u0442 \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044c\u0435\u043a\u0442 \u043a\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043e\u0437\u0432\u0430\u043b\u0441\u044f. \u0415\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f null.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 <code>target<\/code> <code>UIApplication.sendAction<\/code> \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u043b\u0438\u0431\u043e \u043a\u043b\u0430\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 <code>objc_msgSend<\/code> \u0438\u043b\u0438 <a href=\"https:\/\/developer.apple.com\/documentation\/objectivec\/nsobjectprotocol\/1418667-perform\" rel=\"nofollow noopener noreferrer\">perform(_:with:with:)<\/a>, \u0431\u043b\u0430\u0433\u043e <code>objc_msgSend<\/code> \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 <code>null<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <code>id<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u0432\u044b\u0437\u043e\u0432\u0430 callback-\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<h3 id=\"uiaction-aka-_actionhandler\">UIAction aka _actionHandler<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441 <code>UIAction<\/code>, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0432 \u043f\u043e\u043b\u0435 <code>UIControlTargetAction._actionHandler<\/code>, <code>UIControl._sendActionsForEvents<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>UIControl.sendAction(_:UIAction)<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>UIAction._performActionWithSender<\/code>.<\/p>\n<p>  <\/p>\n<p><code>UIAction._performActionWithSender<\/code> \u0434\u043e\u0441\u0442\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043b\u0435\u0436\u0430\u0449\u0435\u0435 \u0432 \u043f\u043e\u043b\u0435 <code>UIAction.handler<\/code> \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c <a href=\"https:\/\/clang.llvm.org\/docs\/Block-ABI-Apple.html\" rel=\"nofollow noopener noreferrer\">\u0431\u043b\u043e\u043a\u043e\u043c<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043f\u043e\u043b\u0435 <code>invoke<\/code> \u0443 \u043d\u0430\u0441 \u043b\u0435\u0436\u0438\u0442 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 <code>UIAction<\/code> \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435, \u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0432\u0440\u0430\u043f\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438 \u043f\u043e \u043e\u0444\u0444\u0441\u0435\u0442\u0443 0x20 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0435\u043c\u0443.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_8\/jm\/p2\/_8jmp2ohbfhvbiqg5ss1dnn5orq.png\" alt=\"UIControl._sendActionsForEvents\" data-src=\"https:\/\/habrastorage.org\/webt\/_8\/jm\/p2\/_8jmp2ohbfhvbiqg5ss1dnn5orq.png\"\/><\/p>\n<p>  <\/p>\n<h2 id=\"realizaciya\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u0430\u043a\u043e\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<br \/>  \u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438\u043c\u0435\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 frida \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u0443\u044e \u043a \u043d\u0435\u043c\u0443.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0438\u0437 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432\u0441\u0435 callback-\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>UIControl._targetActions<\/code>. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u0441\u0435 <code>UIControl<\/code> \u0431\u043b\u0430\u0433\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>choose<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">uiControls = ObjC.chooseSync(ObjC.classes.UIControl)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e <code>UIControl<\/code> \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 <code>_targetActions<\/code> \u0438 \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u0435\u0439\u0441\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">var targetActions = uiControl.$ivars._targetActions \/\/ \u0434\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 UIControlTargetAction \u0438\u043c\u0435\u0435\u0442 \u043b\u0435\u043d\u0438\u0432\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e if (targetActions == null) {    console.log(\"\\tNo callbacks found\")    return } var count = targetActions.count().valueOf()  for (let i = 0; i !== count; i++) {    var action = targetActions.objectAtIndex_(i)    \/\/ \u0422\u0443\u0442 \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u0442\u0440\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u043d\u0435\u0435 \u0441\u043b\u0443\u0447\u0430\u044f    \/\/ 1. \u041a\u043e\u0433\u0434\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d UIAction    if (action.$ivars._actionHandler != null) {        var uiAction = action.$ivars._actionHandler        interceptUIAction(uiAction)    \/\/ 2. \u041a\u043e\u0433\u0434\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0437\u0430\u0434\u0430\u043d \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u0438 \u043e\u0431\u044c\u0435\u043a\u0442 \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d    } else if (action.$ivars._action != null &amp;&amp;                action.$ivars._action != \"0x0\" &amp;&amp;                action.$ivars._target != null) {        var actionSelector = action.$ivars._action        var actionTarget = action.$ivars._target        interceptActionWithTarget(actionSelector, actionTarget)    }    \/\/ 3. \u041a\u043e\u0433\u0434\u0430 \u0437\u0430\u0434\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440    else if (action.$ivars._action != null &amp;&amp;        action.$ivars._action != \"0x0\"){        var actionSelector = action.$ivars._action        interceptActionWithoutTarget(actionSelector, uiControl)    }    else {        console.error(\"Invalid UIControlTargetAction with actionHandler and action seted to null\")        continue    } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 callback \u0437\u0430\u0434\u0430\u043d <code>UIAction<\/code> \u044f \u0441\u043c\u043e\u0433 \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0431\u0430\u0433 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0441\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function interceptUIAction(uiAction) {    var blockAddr = uiAction.$ivars._handler.handle    \/\/ \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u0438\u0431\u043e invoke() \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0445\u0435\u043b\u043f\u0435\u0440    var closurePtr = blockAddr.add(0x20).readPointer()    \/\/ \u0438 \u0434\u0435\u0431\u0430\u0433 \u0441\u0438\u043c\u0432\u043e\u043b\u044b    var closureName = DebugSymbol.fromAddress(closurePtr).name    \/\/ \u043f\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u0435\u0449\u0435 \u0438 sender - UIControl \u043d\u043e \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043d \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d?    console.log(\"\\tSet hook on: \" + closureName)    Interceptor.attach(closurePtr, {        onEnter: function(a) {            this.log = []            this.log.push(\"Called \" + closureName)        },        onLeave: function(r) {            console.log(this.log.join('\\n') + '\\n')        }}) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u044f \u043d\u0443\u0436\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0448\u0430\u0435\u043c \u0445\u0443\u043a.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function interceptActionWithTarget(actionSelector, target) {    console.log(\"\\tSet hook on: \" + target.$className + \".\" + actionSelector.readUtf8String() + \"()\")    var impl = target.methodForSelector_(actionSelector)    Interceptor.attach(impl, {        onEnter: function(a) {            this.log = []            this.log.push(\"(\" + a[0] + \") \" + target.$className + \".\" + actionSelector.readUtf8String() + \"()\")        },        onLeave: function(r) {            console.log(this.log.join('\\n') + '\\n')        }}) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 \u0432 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u043a\u0435\u0439\u0441\u0435 \u0437\u0430\u0431\u043e\u043b\u0435\u043b\u0430 frida \u0438 \u043c\u0435\u0442\u043e\u0434 <code>_targetInChainForAction<\/code> \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e. \u041d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043d\u0430\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 <code>objc_msgSend<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function interceptActionWithoutTarget(actionSelector, uiControl) {    var uiApp = ObjC.classes.UIApplication.sharedApplication()    \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 objc_msgSend    var targetInChainForActionPrototype = new NativeFunction(ObjC.api.objc_msgSend, \"pointer\", [\"pointer\",\"pointer\",\"pointer\", \"pointer\"])    \/\/ \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c))    var actionTargetPtr = targetInChainForActionPrototype(uiApp, ObjC.selector(\"_targetInChainForAction:sender:\"), actionSelector, uiControl)    var actionTarget = new ObjC.Object(actionTargetPtr)    if (actionTarget != null) {        interceptActionWithTarget(actionSelector, actionTarget)    } else {        console.warn(\"Can't get target for selector: \" + actionSelector.readUtf8String())    } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u0438 \u0432\u0441\u0435! \u0413\u043e\u0442\u043e\u0432\u044b \u0441\u043a\u0440\u0438\u043f\u0442 \u043b\u0435\u0436\u0438\u0442 <a href=\"https:\/\/github.com\/chepaika\/frida-ios-clicklog\" rel=\"nofollow noopener noreferrer\">\u0442\u0443\u0442<\/a>. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e \u0432 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0438 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 callback-\u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 iOS.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/713732\/\"> https:\/\/habr.com\/ru\/post\/713732\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041e\u0441\u043d\u043e\u0432\u043e\u0439 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u0430\u043c, \u0442\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0441\u0430\u043c\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u043f\u0440\u044f\u043c\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0443\u0436\u0435 \u0441\u043e\u0431\u0440\u0430\u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043b\u043e\u0433\u0438\u043a\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0440\u0435\u0432\u0435\u0440\u0441\u0443.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 callback \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 iOS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/frida.re\/\" rel=\"nofollow noopener noreferrer\">frida<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u044f \u0434\u0443\u043c\u0430\u044e \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0442\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0430 iOS \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043d\u0443\u0440\u044f\u043d\u043a\u0430 cllaback-\u043e\u0432 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0435\u0442\u0435\u0440\u043f\u0435\u043b\u0438\u0432\u044b\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 <a href=\"https:\/\/github.com\/chepaika\/frida-ios-clicklog\" rel=\"nofollow noopener noreferrer\">\u0442\u0443\u0442<\/a>.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-344676","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344676","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=344676"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344676\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}