WWDC2014 IOS8 APP Extensions

Source: Internet
Author: User
Tags notification center

This article is reproduced to http://blog.csdn.net/jinkaiouyang/article/details/35558623 thanks to the author for sharing

WWDC14 's most exciting addition to the new language SWITF is undoubtedly the opening of the entire Apple platform. When it comes to openness, of course, it belongs to extension. Extension enables the sharing of functions and resources across applications.

Let's take a look at extension specific

Today- in the "Notification Center" of the IOS system, "gadgets, widgets" that support third-party app integration, such as the price-viewing gadget offered by EBay, calendar notifications, etc.

Share- in all menus on the IOS system, the sharing and sharing feature provided by third-party apps is supported.

Photo Editing- in the Photos app of the IOS system, supports direct editing using the third-party app "picture editing" app.

Action- supports third-party application "plugins", such as Microsoft's Bing Translate, in the "Safari" browser of the IOS system.

Custom keyboard- supports third-party "keyboard input", such as Swype, in the "keyboard" function of the IOS system.

Let's take a look at two points that are worth more to us.

First, Today

today– is the column that informs the center of today. In today's extension is also called Widgets: small tools, small plug-in meaning. Here we can quickly get some more important information.

Take a look at the implementation of a few small demo

1, after installing the application with widgets, the system will not help you open the default, you need to be in the notification center-today's column-drag to the bottom-edit, you will see the added widgets and the widgets to be added

2, the QQ space is added (added in can also be manually removed, click on the left button will go out Remove buttons)

3, press Done to exit, you can see the effect added

(1) The simulation reads the latest dynamic display of space. This allows the user to immediately see some of the latest developments in the notification center without having to open the space.

(2) Here the simulation shows some new information, such as you have a few new news, XXX reply to you, add visitors, new shelves of cover and so on. Click on one of the items, you can open qzone to enter the specific function page.

Second, Share

Share eension.

1, the system album inside open images, choose to share, pop-up menu, you can choose to share the application containing shareextension. As shown below

2, click to share, will be in the current interface pop-up below the sharing input box, share type support picture (can be customized number), video, text, links and so on.

With this operation, you do not need to open another app to jump, in the current interface can quickly realize the sharing operation.

Third, Photo Editing

Photo editing is similar to share. In the image current interface, you can call the third-party app to edit the image's ability to edit the picture, after editing, you can immediately return the results to the caller.

Select the picture, edit, select the upper left corner of the button, pop-up options box, the third-party app in the options box provides the ability to edit the image, click on the current interface to call the third-party app image editing interface for image editing.

The above are some of the experience and product features on the introduction. Let's take a look at what the yards farmers really care about, how these tall functions are implemented.

Extension Introduction

1. What is extension?

Extension is not a standalone app that is included in our Release app installation package and is a standalone binary that runs in a standalone process, but can only be attached to an app. Extension is packaged and distributed with the application, cannot be published separately, cannot be downloaded separately, and cannot be run directly by the user.

2. Extension life cycle

As can be seen, the extension will be killed immediately after the system kill. So extension can not complete the time-consuming upload and download tasks, what do these tasks with what to do, please continue to see ~ ~ ~

3. The relationship between extension and containing app

App extension is a standalone binary file that appextension run containing app (with extension app) and not necessarily running.

So extension will not be called directly with the containing app, and extension and his host app can be called directly.

App extension opens the containing app via the open URL. Get the same piece of data in a way that is shared by the resource. As shown in the following:

4. Codeshare--sharing code with Your containing APP

Extension and containing apps share code in a way that is shared through the embedded framework.

NOTE

If your iOS applinks against an embedded the framework, you must specify a minimum deploymenttarget of iOS 8.0. If your IOS extensions link against an embedded frameworkbut their containing app does not, you can use an earlier Deploym ENT target forthe app.

5. Data sharing--sharing with Your containing App

You can share data by creating app groups with Xcode and portal and adding extension and containing apps to group.

6. Interacting with the Web page--Accessing a webpage

You can also use JS to interact with Web pages and change Web page data via extension.

7, processing time-consuming tasks-performing a long-running task when extension need to perform time-consuming operations, you need to use nsurlsession to achieve background data transfer. Because the background data transmission mode uses the different precess with the extension, the timely extension is closed the transmission still can continue.

Simple Today Widgets Build

1, first, we have to build an app project, we can add our extensions on the basis of the containing app. That's not the introduction.

2, add extension target. File->new->target Select a applicationextension column, such as

Apple has provided us with all the extension templates, which already contain all the basic configurations.

3, select Todayextension Click Next, after the name is completed.

4, do not need to change a line of code , run, run the results as shown:

5, a widgets is a viewcontroller, all of his event cycle with the controller is consistent. We can add a variety of button labelimageview and even tableview on his basis. But because he is in the notification center, there are a lot of widgets, in order to avoid the impact of experience, Tablveview best not support scrolling.

6, for the widget update, a new protocol ncwidgetproviding

When the notification Center in the extension display will first callback this function for data updates, data Update we need to call the Completionhandler notification interface update.

Each time the interface is updated, the notification center is saved as a diagram to show the data more quickly next time.

The above is today extension---Widget of a simple introduction, the implementation of a demo is very simple, but to be linked with our app, to the background to implement protocol data transfer, or is more troublesome, need to consider how to reuse existing code, need to consider the sharing of data, How to get data using background mode.

Here's a brief introduction to Apple's open component-extension and how to build a preliminary demo. There are more exciting points that need further digging.

http://wangzz.github.io/blog/2014/06/23/wwdc2014zhi-app-extensionsxue-xi-bi-ji/

WWDC2014 IOS8 APP Extensions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.