【发布时间】:2019-11-04 11:38:27
【问题描述】:
我正在调查在哪里制作/展示了一个有问题的错误配置的警报控制器
由于未捕获的异常“NSGenericException”而终止应用程序, 原因:'您的应用程序提供了一个 UIAlertController () 风格 来自 UP.BVTabBarViewController 的 UIAlertControllerStyleActionSheet ()。 modalPresentationStyle 具有这种风格的 UIAlertController 是 UIModalPresentationPopover。 您必须通过 警报控制器的 popoverPresentationController。您必须提供 sourceView 和 sourceRect 或 barButtonItem。如果这 当您出示警报控制器时,信息未知,您 可以在 UIPopoverPresentationControllerDelegate 方法中提供它 -prepareForPopoverPresentation。
天真地我试过这个:
(lldb) br s -n "-[UIAlertController init]"
Breakpoint 100: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
什么是正确的(工作)方式?
【问题讨论】:
-
为什么需要断点?很明显错误是什么;你为什么不把它修好?在您的代码中搜索
actionSheet。 iPad 上的操作表必须始终配置为带有箭头源的弹出框。 -
我有大约十几个呼叫站点,宁愿避开添加 12 个断点来识别配置错误的警报控制器实例的“乐趣”
-
但它会在视觉上立即显而易见。它将是不配置弹出框的那个!一打并不多。将它们全部查看比一遍又一遍地运行应用程序试图让有缺陷的应用程序出现要快得多。