Of all the new features iOS 8 presented at the WWDC, the most important, perhaps, are the extension (extensibility). They should have a great impact on the further development of the OS. Often this feature is described as "the ability of third-party applications to interact with each other." This, of course, is too exaggerated, since the interaction is not the only possibility of extensions, and they can not communicate directly with each other, to be exact.
We have read the developer documentation and videos from WWDC, to understand how extensions work and how Apple has found a compromise between the openness of the system and user data security and would like to talk about it you.
So what do the expansion?
Enabling third-party applications to access each other, it is only one problem, which is to solve the expansion. Side of the keyboard; application integration with other cloud storage, in addition to iCloud; widgets in Notification Center - all this is also borne by the extensions.
In fact, not all of the iOS may be "enhanced" third-party developers. For example, if you want to replace the default application or add a switch in the control room - you will not work. Apple provides is not so much clearly defined "extension points» (extension points), to show the developers with any part of the operating system they can work. A list of these points as follows:
- expansion Today (Today extensions) or widgets - are used to provide instant information in the Notification Center. You can consider them as a response to the live tiles Windows Phone and Android home screen widgets.
- enhance the exchange of (Share extensions) - allow you to send photos, links or other files of the application in the online services. Such as posting photos in Pinterest or upload files to Dropbox or OneDrive directly from the application.
- scaling up (Action extensions) - used to "manipulation or viewing content in the context of another application." In other words, this means that you can edit the photo, which is contained in a text document, or, For example, as shown in the presentation, use something like Bing Translate to translate text in a window Safari.
- Extensions for photo editing (Photo Editing extensions) - can use the editing capabilities of other applications when viewing images in the camera roll.
- expanded storage (Storage Provider extensions) - allows applications to open documents from a number of cloud storage. For example, you can use to store your documents Dropbox and access them directly out of the Office for iPad or Pages.
- Extensions for third-party keyboards (Custom keyboard extensions) - replace the standard keyboard in iOS.
Said extensions are iOS, but many of them (including widgets exchange and expansion al.) Running in OS X Yosemite, as well as in iOS. applications from the App Store developers of the Mac face similar restrictions sandbox and implementation of extensions bit simplify their lives. Though, most likely, many developers continue to evade them, avoiding the Mac App Store at all.
This preliminary list of extension points differs from the system intents (Intents system), working in Android. Apps on Android use the filters to understand the operating system what actions they can perform and handle. For example, Twitter and Facebook can post photos and links; Google Drive, and Dropbox can download various files; Chrome and Firefox can open web pages, etc. Third-party developers can even set filters themselves, which will operate in the operating system.
At the same time, iOS is much limitation in this regard, although not without a reason. However, for ordinary users will not notice all this and expand a little than will differ from their counterparts Android, iOS while maintaining security policy.
How to install extensions, and how do they work?
As well as all the official app for iOS, extensions downloaded from the App Store. The biggest limitation here is that Apple does not allow developers to publish extensions in "pure form". Each extension must be distributed as part of the application (containing app), which in turn should carry any basic functionality and be useful to the user. That is, developers can not publish to the App Store just a widget or just the keyboard, as is happening now in the Android. At the same time, Apple does not impose any restrictions on the number and types of extensions, which can contain your application.
Other recommendations for the Apple developers are not required. This applies to the design of extensions, which should correspond to the standard OS applications: widgets do not differ from existing widgets in Notification Center, and photo editing menu in the Camera Roll - radically different from native. Probably there are those who fail to comply with these recommendations, but mainly because the majority of developers and adhere to the philosophy of Apple when creating their applications.
Each extension is activated in different ways. Widgets - from Notification Center, keyboards - from the regional system settings. Expansion of photo editing and storage are called only in certain situations of applications that provides interaction with them. Enhance the exchange and action can be called from any application, but the developers must add the activation rules to expand and specify which data is to be processed. If your extension only provides for the exchange of photos, you need to specify it in the activation of the rules that the expansion does not appear when a user wants to share a link or document.
Despite the fact that all the extensions must be "packaged" in the application (containing app), they can work independently. Each extension - this is a small binary .appex-file, which opens the job done and closed without having to start the main application. For extensions that perform the same tasks as their main application (e.g. Instagram, used for adding a filter to the image) are encouraged to use a built-in framework for the transmission of executable code required for the respective task. Create a framework, put the code in there and you will be able to build this framework both in the application and in the extension. The only restriction here is that these applications will require iOS version 8 and above, as will not run on earlier operating systems.
One of the reasons for the expansion run separately from the application thereof, is Apple hard limit on the amount of memory consumed. In particular this applies to the widget, as the user can have multiple concurrent widgets.
In addition, the widgets do not work for a long time, and forcibly removed from the device after the closing. For extensions that perform lengthy background tasks, such as downloading files, Apple recommends to transfer these tasks system, and then close it.
That's all the main points, on iOS extensions. As you can see all the possible extensions strictly documented, but is notable for the fact that despite the enhanced powers, provided by developers and their applications, they do not violate existing security policy and work within its "Sandbox".
Security of user data. Differences from Android
In a nutshell, the difference between the approach to the privacy and security data iOS and Android users It is that the latter provides developers with a number of the rope, which is sufficient to hang himself.
In fact, if Android users use the default security settings before the installation of each application read the extensive list things it can do - the danger of their personal data to third parties or malware infection was not so great. But all these rights applications lead to confusion. Some people choose to install applications not only from Google Play, but also from other sources; others wish to get root-access, in order to install alternative distributions - no problems, everything is possible with Android. Such things are of interest some users to the platform, but they do it all on your own risk.
Look at the iOS, which, even with the introduction of expansions still erects barriers between applications and their extensions and data applications to protect users (and their information) from themselves. As we have said, still applications can not address each other directly, because the expansion is small binary files that run separately from the containing application. Any application which causes expansion (host app in Apple terminology) refers to expand, but not to the application that it comprises (containing app). In this case, when the host application needs to use the extension, it sends a request via the system framework, rather than directly, and never will have access to application data.
Developer of FortyTwo Inc. Eduardo Fonseca explains how to manage to keep iOS apps, and extensions "at a safe distance."
"Each extension - this is a separate bundle (bundle) inside the main bundle application that contains separate executables" - says Fonseca. "The funny thing here is that the expansion is not an application. It is caused through the Apple system frameworks, using a clearly defined interface, which initiates the process of starting expansion. In this case, the code is executed separately, and this implies that the performance of any third-party code can not be inside the application. Therefore, there is no risk that the applications that will support the extension (such as Safari), you may experience problems when you use extensions inside other applications. They are like oil and water - they do not mix. "
Even if the expansion is necessary to refer to having the same application, it buet occur only through the system API. By default, the app contains the extension and expansion of itself can not access each other's data.
For the exchange of data between them, you need to make them part of a group of applications (App Group), which will allow them to have some general information in the external container, both outside the sandbox. You probably noticed that once logging into your account in Google Chrome on iOS, you will also be logged in and to Google Maps and Google Drive - it is the result of using the App Group. But even these groups are limited to certain types of data that can be exchanged. Permitted exchange database cache account information. However, for local documents and media files is not the case - they are still banned.
Simply put, Apple does not want some applications to have access to a sandbox other. Extensions are small sandbox within another sandbox, that will facilitate the interaction of different applications, but never allowed near launching the application (host app) data application that contains an extension (containing app).
Mechanisms run Extensions are also different from the application. If you run the same extension in several applications, such as Safari and Mail, the system will open two copies of this expansion, which will run in separate processes. These extensions are stored in different memory areas. Thus the information of both applications is stored in different places, and they only have access to their data. For the same reason, browsers open up a variety of sites in separate tabs.
Android provides its own sandbox model, which also aims to protect the data stored in one application from other applications that do not have access to them (although, if desired, developers can easily work around it). Especially dangerous here is the granting of rights to read and write access to all data of applications that outdated even Android 4.2., although the application is still able to access the data of other applications.
Again, all of these mechanisms are only effective when used correctly, but people tend to be rare read the license agreement and just agree with those requests, which provides software to install, exposing their data risk. Apple is very well-suited to this issue, and even now in iOS has a comfortable setting with privacy switches, which can be clearly seen what prilolzheniya use some information. Something like Google announced in Android 4.4, but in the final release of this, unfortunately, was not there. It has no direct relation to the extension, but this is a good example of how the iOS 8, continues to sacrifice flexibility for the sake of the security and privacy of users.
Apple also imposes other restrictions on expansion - they can not use all the API, which is accessed by applications. In particular custom keyboard limited number of mandatory requirements and rules. Mechanisms of interaction Apple extensions are different from those that use Google and, in fact, iOS 8 remains closed operating system, compared with Android. Third-party applications still can not communicate directly between themselves, and system elements such as home screen or lock screen is not amenable to customization, as well as applications for Default.
Nevertheless, it seems that Apple has finally listened to the single biggest complaints about its mobile platform and has taken measures, but characteristic for her style, without drastic action, which could increase the memory requirements or security threats users. Now, while iOS 8 has not yet been published, it is difficult to judge the advantages and disadvantages of such an approach, but on paper it all looks very promising.
(via)