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

查看:31
本文介绍了有没有官方的方法可以在 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 文档

有一段关于手表应用和 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 应用程序读取,反之亦然.

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天全站免登陆