有没有官方的方式在Apple Watch和iPhone之间传递数据? [英] Is there an official way to pass data between Apple Watch and iPhone?

查看:357
本文介绍了有没有官方的方式在Apple Watch和iPhone之间传递数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道除了MMWormhole之外还有其他办法在iPhone和Apple Watch之间传递基本数据。你知道现有的官方Apple框架是否允许这样做吗?

I was wondering if there is any other way besides MMWormhole to pass basic data between iPhone and Apple Watch. Do you know if any existing official Apple framework allows this?

推荐答案

这是可能的。

查看: WatchKit Doc's

有一个关于手表应用程序和扩展程序之间共享数据的段落iPhone。

There is a paragraph on sharing data between the watch app and the extension on the iPhone.

引用第一段。


与您的包含共享数据iOS应用程序

Sharing Data with Your Containing iOS App

如果您的iOS应用程序和WatchKit扩展程序依赖于相同的数据,请使用共享应用程序组来存储该数据。应用程序组是多个进程可以访问的安全容器。由于您的WatchKit扩展和iOS应用程序在不同的沙箱环境中运行,因此它们通常不共享文件或直接相互通信。应用程序组允许两个进程在它们之间共享文件或用户默认信息。

If your iOS app and WatchKit extension rely on the same data, use a shared app group to store that data. An app group is a secure container that multiple processes can access. Because your WatchKit extension and iOS app run in separate sandbox environments, they normally do not share files or communicate directly with one another. An app group lets the two processes share files or user defaults information between them.

据我所知,MMWormhole非常方便2个二进制文件之间的实时数据更改。而这种方法允许访问iPhone应用程序保存的数据,可以通过Watch App和Vice Versa读取。

From what I understand MMWormhole is handy for as close to realtime data changes between the 2 binaries. Whereas this method allows for accessing data used saved by the iPhone app that can be read by the Watch App and Vice Versa.

这篇关于有没有官方的方式在Apple Watch和iPhone之间传递数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆