以编程方式打开Apple Health [英] Open Apple Health programmatically

查看:118
本文介绍了以编程方式打开Apple Health的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以像使用设置"应用程序那样以编程方式打开健康"应用程序?

Is it possible to open the Health app programmatically, like one can do with the Settings app?

如果无法直接打开应用程序的Apple Health权限屏幕,我们至少可以打开Apple Health主屏幕吗?

If it's not possible to open the app's Apple Health permissions screen directly, can we at least open the main Apple Health screen?

编辑 :我知道我无法再次请求权限-就像使用摄像机访问"等其他操作一样.但是,如果用户拒绝摄像机"权限,我可以将他们直接定向到设置"页面,他们可以在其中更改这些权限.

Edit: I know that I cannot request permissions again - just like with other things like Camera access, etc. However, if the user refuses Camera permissions, I can direct them to the Settings page directly where they can change those permissions.

NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:url];

Health App有这样的东西吗?

Is there such a thing for Health App?

推荐答案

自iOS 10以来,可以打开Health应用程序.

It looks like since iOS 10+ it is possible to open the Health app.

UIApplication.shared.open(URL(string: "x-apple-health://")!)

有关详细信息,请查看此

For details take a look at this

Stackoverflow帖子

这篇关于以编程方式打开Apple Health的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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