I am working on a Pythonista script that displays a UITabBarController
, which contains multiple UINavigationController
s, containing UITableViewController
s. At some point I need to display a UIAlertController
, but all the methods I've tried to present it either crash the app or push the UIAlertController
to the navigation stack.
My code:
from objc_util import *
from UIKit import *
alert = UIAlertController.alertControllerWithTitle_message_preferredStyle_('Title', 'Message', 0)
def alertActionCancel(sender):
print 'Cancelled!'
alertActionCancelBlock = ObjCBlock(alertActionCancel, None, [c_void_p])
retain_global(alertActionCancelBlock)
alert.addAction_(UIAlertAction.actionWithTitle_style_handler_('Cancel', 1, alertActionCancelBlock))
myTableViewController.presentViewController_animated_completion_(alert, True, None) # This line crashes Pythonista
Thanks in advance, any help is greatly appreciated.