From 0d11c9f9fd2d9c438ebf96c24af3f6204f0675c5 Mon Sep 17 00:00:00 2001 From: Josh Bruhin Date: Thu, 9 Feb 2017 15:17:49 -0700 Subject: [PATCH] =?UTF-8?q?Bridge-1684=20call=20becomeFirstResponder=20wit?= =?UTF-8?q?h=20dispatch=20to=20main=20queue=20after=20delay=20to=20prevent?= =?UTF-8?q?=20invisible=20keyboard=20when=20user=20hits=20=E2=80=98cancel?= =?UTF-8?q?=E2=80=99=20in=20touch=20ID=20context?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ResearchKit/Common/ORKPasscodeStepViewController.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ResearchKit/Common/ORKPasscodeStepViewController.m b/ResearchKit/Common/ORKPasscodeStepViewController.m index c2c6c0a1e8..b2198d129d 100644 --- a/ResearchKit/Common/ORKPasscodeStepViewController.m +++ b/ResearchKit/Common/ORKPasscodeStepViewController.m @@ -369,7 +369,17 @@ - (void)promptTouchId { }]]; [strongSelf presentViewController:alert animated:YES completion:nil]; } else if (error.code == LAErrorUserCancel) { - [strongSelf makePasscodeViewBecomeFirstResponder]; + + // call becomeFirstResponder here to show the keyboard. dispatch to main queue with + // delay because without it, the transition from the touch ID context back to the app + // inexplicably causes the keyboard to be invisble. It's not hidden, as user can still + // tap keys, but cannot see them + + double delayInSeconds = 0.3; + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); + dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ + [strongSelf makePasscodeViewBecomeFirstResponder]; + }); } [strongSelf finishTouchId];