Reputation: 5806
I'm investigating where an offending misconfigured alertcontroller is 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.
Naively I've tried this:
(lldb) br s -n "-[UIAlertController init]"
Breakpoint 100: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
What's the proper (working) way?
Upvotes: 0
Views: 691
Reputation: 6489
To provide a more generic answer, for any class you can do:
br s -r '-\[UISomeClass init'
br s -r '\+\[UISomeClass '
The first creates a breakpoint on any method starting with init
. The second matches all class methods, and creates breakpoints for each.
There is one case that neither approach covers: superclass methods. Maybe not a concern for UIAlertController
, but in general breakpoints can only be set like this on the methods the class implements, not on inherited methods.
Upvotes: 3
Reputation: 534885
Unless you're doing this completely wrong, your alert controllers are all created by calling
+[UIAlertController alertControllerWithTitle:message:preferredStyle:]
However, there is really no need for this breakpoint, and it won't help you because you won't encounter the breakpoint unless you summon the particular alert that is causing the problem. Instead, just search your code globally for .actionSheet
and fix the one that isn't configured as a popover.
The rule is that on iPad all action sheets must be explicitly given a source view or source bar button item for the arrow to point to; it will be immediately obvious when you come to an action sheet for which you're not doing that.
Upvotes: 1