Pocketed input method is how to achieve app settings without the need for full access?

All to known,On iOS since 8.0 Start version,Keyboard can be developed for iOS third-party input method,These keyboards can be sold on the AppStore,but,But also has a very strict access rules。

This,Apple's third-party keyboard design of the two permissions,A minimum of,Permissions Only the most basic functions of the keyboard、Another relatively more,Get the keyboard "Full Access"Basically after permission and android Almost on the keyboard,You can access contacts、It can be networked, etc.。

but,Many keyboard function is to set up a user had to request the "full access",Because they found,Failure to do so,As a plug-in keyboard can not access a host app storage space。

In the ios,Although your keyboard in the form of a app to sell and use,But the keyboard is actually a "plug-in",It consists of a single load ios,So in fact it and your app is "two different applications.",They have a separate storage space。

If you give it time to develop a user does not request full access to the keyboard,You'll need to add an additional button in the keyboard,And an interface to set the keyboard properties。And this application app,Then add some empty beginners guide and so on hastily。

For example,

Relatively old Larry input SPI is doing,Its app in novice guide and user forums,Is provided on the keyboard has specialized keys:

Set the boot of spi input method app

Really no way to it?

In fact, it is there,There is a development in the ios called "AppGroup" Technology,It can give the same developers of groups playing different app,Provide a common storage space for these app,In this case between different applications a developer can be exchanged with some configuration files or,To provide users with better services - such as configuration information。

For your application and keyboard at the same time open AppGroup

Speaking Nothing special

Apple uses a third-party keyboard AppGroup start is no limit,We can say that this is a bug - use AppGroup keyboard without getting full access,You can also transfer the collected information to go,But after ios10,They perfected the authority,- The keyboard can only be read but not write to the contents of the shared space AppGroup。

But the good news,We can do so that control of the keyboard app。You have thought of,Just put the configuration file in a shared directory,Then take the initiative to read keyboard enough。

So how do some of the newer problems? For example, I can detect whether a file exists,I can load the configuration information,However, if a thesaurus,It just content changed ......

If every line and come back from a shared space,It will be very resource-intensive,So I used the mechanism of a "version number",Every additional proofread it。

This is why a certain point after a start pocketed input method requires the user to configure the complete "return",Because it will trigger an updated version,Keyboard will read。

Thus in simple,But doing it is more complicated - or tedious,You need to preserve the unity part serialization and de-serialization of the tools in the app and keyboard,Here I myself used a single model to specialized management rather than their own access。(Note that you can not use lazy loading,Although the benefits of this feature infinity,But you do it occasionally difficult to change the configuration will lead to,The life cycle of the keyboardUnpredictable - Despite the generally hide keyboard After five seconds)。

Code CI Hou

Here I put my snippet posted to you:

Paths can use this method in the application and in the keyboard to get the AppGroup,Only the keyboard is read-only,And this application has full read and write access。

Other configuration and the general reader makes no difference,You should pay attention,You can also write to the configuration,But this is not valid - the point isThere will be no errorsprompt。


In fact, search dogs also use this method of,After all, do not open full access to the case,Sogou can still use the application for the basic configuration of the keyboard - you should pay attention to,In ios 10 Previous versions,The keyboard iscanTo share spaceWriteof,I would mention such a。


Original article written by Gerber drop-off:R0uter's Blog » Pocketed input method is how to achieve app settings without the need for full access?

Reproduced Please keep the source and description link:https://www.logcg.com/archives/2488.html

About the Author


The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Leave a Reply

Your email address will not be published. Required fields are marked *