书上问题求助:184页获取编写邮件的响应函数

鉴于论坛大量涌入新人且提问缺乏必要信息导致问题无法解决,目前暂行提问模版机制。试运行期间内新帖没有按照这个模版发帖将导致 锁帖/删帖/封号
(除非有原因,某些问题无法分类进下面的分支。这一点完全靠管理员唯一指定,大多数普通问题请老实按照下面的分类)

标**的为可选项

需求: (请勿使用 “我的需求是a但是我认为b可以解决a所以我来问问b” 这种提问模式,会造成误导)
**日志: (例如iOS系统的日志,OS X上相关操作的日志,etc)
**代码: (如果项目本身代码不方便发布请提供最小问题重现代码)
操作步骤: (请详细描述自己每步做了什么操作)
** 任何其他描述: (描述问题的现象,等等)
** 环境: macOS10.15, iphone 5s, iOS9.2.1

书上184页,获取编写邮件的响应函数,此时lldb调试的结果如下
(lldb)
Process 5467 stopped

  • thread #1, queue = ‘com.apple.main-thread’, stop reason = instruction step over
    frame #0: 0x0000000187b1fe4c UIKit-[UIApplication sendAction:to:from:forEvent:] + 96 UIKit-[UIApplication sendAction:to:from:forEvent:]:
    -> 0x187b1fe4c <+96>: bl 0x182475bc0 ; objc_msgSend
    0x187b1fe50 <+100>: cmp x22, #0x0 ; =0x0
    0x187b1fe54 <+104>: cset w0, ne
    0x187b1fe58 <+108>: ldp x29, x30, [sp, #0x20]
    Target 0: (MobileMail) stopped.
    (lldb) po (char*)$x0
    <MailAppController: 0x14e810600>

(lldb) po (char*)$x1
“performSelector:withObject:withObject:”

(lldb) po (char*)$x2
“composeButtonClicked:”

(lldb) po (char*)$x3
<ComposeButtonItem: 0x14f89a8f0>

(lldb) po (char*)$x4
<UITouchesEvent: 0x14f9ea8a0> timestamp: 66975.8 touches: {(
<UITouch: 0x14fa2d240> phase: Ended tap count: 1 window: <UIWindow: 0x14f858b10; frame = (0 0; 320 568); autoresize = W+H; tintColor = UIDeviceRGBColorSpace 0 0.478431 1 1; gestureRecognizers = <NSArray: 0x14f85a3e0>; layer = <UIWindowLayer: 0x14f858090>> view: <UIToolbarButton: 0x14f89b4d0; frame = (285 0; 23 44); opaque = NO; gestureRecognizers = <NSArray: 0x14e79d380>; layer = <CALayer: 0x14f89b140>> location in window: {300.5, 553.5} previous location in window: {300.5, 553.5} location in view: {15.5, 29.5} previous location in view: {15.5, 29.5}
)}

问题:
1 按如上的参数,对应的调用函数不应该是 [MailAppController performSelector:“composeButtonClicked” withObject: ComposeButtonItem withObject : UITouchesEvent ], 为什么是[MailAppController composeButtonClicked:ComposeButtonItem]

2 分析到[MailAppController composeButtonClicked:ComposeButtonItem]以后,为什么不继续往下分析composeButtonClicked 的实现了呢?

是不是木OC基础?
1.performSelector 也是调用 [MailAppController composeButtonClicked:ComposeButtonItem]
2.例子是要打开发送邮件页面,因为功能已经达到了

1 Like

了解了 多谢多谢