本文介绍了我可以从iWatch扩展程序访问Healthkit数据吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个iWatch应用程序,该应用程序需要显示healthkit中的数据.是否可以从iWatch扩展访问healthkit API?

I am making a iWatch app where I need to show data from healthkit. is it possible to access healthkit APIs from iWatch extension?

推荐答案

否. HealthKit框架参考:

您可以做的是调用 openParentApplication:reply:与iPhone应用程序本身进行对话并检索该数据.搜索该方法名称,您将找到一些有关如何调用该方法并将其从其中返回数据的示例.

What you can do is call openParentApplication:reply: to talk to the iPhone app itself and retrieve that data. Search around for that method name and you'll find some examples on how to call it and get data back to the Watch from it.

更新:正如下面其他人提到的,watchOS 2的情况已更改.该文档尚未更新,但请查看 WWDC 2015视频(适用于HealthKit)和观看部分可用于Xcode 7 Beta的代码段.

UPDATE: As others have mentioned below, this has changed for watchOS 2. The documentation has not been updated yet, but check out the WWDC 2015 videos for HealthKit and the Watch for some snippets of code you can use with the Xcode 7 beta.

这篇关于我可以从iWatch扩展程序访问Healthkit数据吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 18:57