Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Touch ID
-
This is my code
from objc_util import * from ctypes import * import dialogs def block(_cmd, succeed, error_ptr): pass context = ObjCClass('LAContext').alloc().init() error = ObjCClass('NSError').alloc().init() print(context.canEvaluatePolicy_error_(1, c_void_p(id(error)))) context.evaluatePolicy_localizedReason_reply_(1, 'Touch ID', ObjCBlock(block, restype = None, argtypes = [c_void_p, c_bool, c_void_p]))
I know we should using objective-c type 'BOOL' here but there are no "BOOL"
That make the app crash
Who can help me make it work -
Try using
c_void_p(error.ptr)
, rather than
c_void_p(id(error))
-- you were pointing to the python object using id, not the objc object!
-
Thank for you help me but it crash again
I think is context.evaluatePolicy_localizedReason_reply_() make it crash and ObjCBlock class has something wrong
I'm sorry but my English is poor -
OK! It is work!
We should use on_main_thread
Like this:replyblock = ObjCBlock(myblock, restype = None, argtypes = [c_void_p, c_bool, c_void_p]) on_main_thread(context.evaluatePolicy_localizedReason_reply_)(1, '爪纹识别', replyblock)