如何在 objc class 的 init 中设置 lldb 断点
How do I set an lldb breakpoint in init of objc class
我正在调查配置错误的 alertcontroller 在哪里 made/presented
Terminating app due to uncaught exception 'NSGenericException',
reason: 'Your application has presented a UIAlertController
() of style
UIAlertControllerStyleActionSheet from UP.BVTabBarViewController
(). The modalPresentationStyle
of a UIAlertController with this style is UIModalPresentationPopover.
You must provide location information for this popover through the
alert controller's popoverPresentationController. You must provide
either a sourceView and sourceRect or a barButtonItem. If this
information is not known when you present the alert controller, you
may provide it in the UIPopoverPresentationControllerDelegate method
-prepareForPopoverPresentation.
天真地我试过这个:
(lldb) br s -n "-[UIAlertController init]"
Breakpoint 100: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
什么是正确的(工作)方式?
除非你完全错了,否则你的警报控制器都是通过调用
创建的
+[UIAlertController alertControllerWithTitle:message:preferredStyle:]
但是,这个断点确实没有必要,它不会帮助你,因为除非你调用导致问题的特定警报,否则你不会遇到断点。相反,只需在您的代码中全局搜索 .actionSheet
并修复未配置为弹出窗口的代码。
规则是,在 iPad 上,所有操作 sheet 都必须明确指定源视图或源栏按钮项,以便箭头指向;当您采取行动 sheet 而您没有这样做时,这将立即显而易见。
要提供更通用的答案,对于任何 class 你可以这样做:
br s -r '-\[UISomeClass init'
br s -r '\+\[UISomeClass '
第一个在任何以 init
开头的方法上创建一个断点。第二个匹配所有 class 方法,并为每个方法创建断点。
有一种情况两种方法都没有涵盖:superclass方法。 UIAlertController
可能不是问题,但一般来说,断点只能在 class 实现的方法上设置,不能在继承的方法上设置。
我正在调查配置错误的 alertcontroller 在哪里 made/presented
Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController () of style UIAlertControllerStyleActionSheet from UP.BVTabBarViewController (). The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.
天真地我试过这个:
(lldb) br s -n "-[UIAlertController init]"
Breakpoint 100: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
什么是正确的(工作)方式?
除非你完全错了,否则你的警报控制器都是通过调用
创建的+[UIAlertController alertControllerWithTitle:message:preferredStyle:]
但是,这个断点确实没有必要,它不会帮助你,因为除非你调用导致问题的特定警报,否则你不会遇到断点。相反,只需在您的代码中全局搜索 .actionSheet
并修复未配置为弹出窗口的代码。
规则是,在 iPad 上,所有操作 sheet 都必须明确指定源视图或源栏按钮项,以便箭头指向;当您采取行动 sheet 而您没有这样做时,这将立即显而易见。
要提供更通用的答案,对于任何 class 你可以这样做:
br s -r '-\[UISomeClass init'
br s -r '\+\[UISomeClass '
第一个在任何以 init
开头的方法上创建一个断点。第二个匹配所有 class 方法,并为每个方法创建断点。
有一种情况两种方法都没有涵盖:superclass方法。 UIAlertController
可能不是问题,但一般来说,断点只能在 class 实现的方法上设置,不能在继承的方法上设置。