I made a module based on your code: https://gist.github.com/d44b83d80f2f77e4f832
To run it you just call
authenticate()with an optional string if you want to supply a reason. It will return
Trueif the user authenticated (with either TouchID or passcode) and
Falseif it was cancelled.
I am working on a Pythonista script that displays a UITabBarController, which contains multiple UINavigationControllers, containing UITableViewControllers. 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.
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.