Apple-watch Development 1

Source: Internet
Author: User
Tags notification center

Communicating between the IOS app and the Watch Extension

There is four scenarios, where an app and a extension might wish to communicate:

  1. Watch extension to suspended/terminated IOS app-use +[wkinterfacedevice openparentapplication:reply:] If you NE Ed to ' Wake up ' your IOS app. If you simply need to leave data in a place for your IOS apps to find it later and then you should write it into the shared GR OUP container and has your IOS app consult it when it next needs the information.

  2. Watch extension to running IOS app-use either +[wkinterfacedevice openparentapplication:reply:] or the Darwin n Otification Center.

  3. IOS app to suspended/terminated watch extension- Since the watch extension was only launched on reaction to your watch App being launched on the Apple Watch, a IOS app cannot launch its corresponding Watch extension. Instead, the app should write whatever data it wants to send to the Watch extension into the shared group container and the extension should consult it when it next needs the information.

  4. iOS app to running Watch extension-if your iOS app received the-[<uiapplicationdelegate> Application:handl Ewatchkitextensionrequest:reply:] message, it should use the system-provided reply block to convey Informat Ion back to the extension. Otherwise you'll use the DARWIN Notification Center-to-pass information back to the extension.

More information on the DARWIN Notification Center can is found in the documentation.

The extension isn't automatically notified of changes to the GKFX user defaults made by the IOS app, and vice versa. If you would as notified, you can do so manually by using the DARWIN Notification Center.

Apple-watch Development 1

Related Article

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.