How to restore UInputViewController self.view after keyboard rejection:

Short explanation: I am developing a keyboard extension application. On some keyboard extension extensions (ex: when I use a toggle button button) the extension goes through viewDidDisappear in which case I know I can clean the keyboard and it is freed from all its views and memory is freed. For other purposes (ex: when using the Notes app and clicking the Finish / Back button) the extension goes through viewWillDisappear but not viewDidDisappear , so in this I am not clearing the keyboard as it does not get through to my clearing methods, and therefore it is not released.

At this point, I would expect that when I go back to the keyboard, go back to the note, for example I would get the previous UIInputViewController with the view already built.

Unfortunately, at this point, the isViewLoaded () method returns false , and my UIInputViewController is started again through the loadView method, so it creates everything again and again, as a result, the application memory grows until at some point I get a nasty one didReceiveMemoryWarning method callback .

I would like to somehow restore the view I created for my keyboard into a UIInputViewController that was initialized first. Does anyone know this and how can this be achieved?

I looked at the restoreIdentifier to accomplish this task, correct me if I'm wrong, but this is used with a regular UIViewController and cannot be used with a UIInputViewController since my AppDelegate is not responsible for starting it.

UPDATE: From further research I have done, I have come to the conclusion that no matter what operation you do:

  • Use the Done / Back button in the Notes app.
  • Go to the Messages app and use your keyboard there.
  • Use the "switch keyboard" button.

And in other scenarios, the UIInputViewController class always passes the init method .

From my understanding of object oriented programming, this means that whoever calls my keyboard for reaper does it with a constructor and basically creates a new instance of the keyboard. This means that I will never have an accessible view of the first appearance of the keyboard in any of the behaviors, and I always need to build the view of the keyboard for the new instance and clear the old one. Is it correct? or is there a way to preview the UIInputViewController view?

Thanks in advance.

+3


source to share


1 answer


Unless you are using your own keyboard app to store your previous instance, there is no way to do this. In everything other than your custom-designed app, it goes beyond



+2


source







All Articles