In iOS custom keyboard app discovery

How to determine which application uses the user keyboard and show another button? For instance. on Twitter, I would add @ to enter the line I'm in the input field and in Reddit / r /

+6
source share
2 answers

It's impossible. The extension works with the sandbox and only downloads information from the API and cannot access anything else. The keyboard can only accept textual contextual changes and activate / deactivate calls. The ability to detect an application is outside the isolation chamber and is therefore not possible.

+2
source

This is possible through the following code. Because you will get the package ID of the application in which you are using your custom keyboard.

Swift

let hostBundleID = self.parentViewController!.valueForKey("_hostBundleID") let currentHostBundleID = String(hostBundleID) print(currentHostBundleID); 

From the package identifier, you can easily find the name of the application.

Good luck

+5
source

Source: https://habr.com/ru/post/987779/


All Articles