我可以从iWatch扩展程序访问Healthkit数据吗? [英] Can I access healthkit data from iWatch extension?

查看:167
本文介绍了我可以从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框架参考:

您无法从扩展程序(例如今日"视图)或WatchKit应用程序访问HealthKit."

"You cannot access HealthKit from extensions (like the Today view) or from a WatchKit app."

您可以做的是调用

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的情况已更改.该文档尚未更新,但请查看

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数据吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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