0

My application have to start automatically dictation (with presentTextInputControllerWithSuggestions with an empty array of suggestions). For this, I schedule a dictation with a delay after X seconds on a certain screen.

But, I have a problem when the user quit the application before the starting of the dictation.

At the beginning, I just scheduled the dictation. If I left the application, the dictation started in background and when I came back on the application, I saw my screen but no dictation screen. If I tried to restart dictation, it didn't work (function is called and dictation start but also in background and the screen doesn't change).

So, I try not to start the dictation if application is leaving before. For this, I change a boolean in the applicationWillResignActive function in the ExtentienDelegate. But, my problem is that this function is not called immediately when the user quit the application. So, if user quit application 1 second or more, before the starting of dictation, the boolean is changed and the dictation doesn't start. When I come back, it works. But, if I quit just before the starting, the dictation continue to start in background and when I come back, I can't restart dictation.

So, could you tell me if there is a solution to change my boolean exactly when the application stop or to find another solution to this problem (stop dictation programmatically,...)

  • This is [an XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Instead of asking how to accomplish how to cancel a delayed presentation, you should explain the problem that led to you delaying the presentation of the text input controller. –  Aug 03 '16 at 13:51
  • @PetahChristian I want to print a text and after 2 seconds, start automatically the dictation. So, I delay the presentation of the presentTextInputController. I know that if I add button to start dictation, I will not have this problem to cancel dictation but I want to start the dictation without button. So, if you have another solution for the X problem which solves the Y problem, tell me. – Pierre Charpentier Aug 04 '16 at 05:43

0 Answers0