Open HealthKit App from another app

后端 未结 3 1567
不知归路
不知归路 2020-12-31 04:31

I want to build a fitness app that will upload the data to HealthKit. Is there any way to open/navigate to HealthKit from another app?

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-31 05:17

    On iOS 10, the Health app URL scheme is x-apple-health. You can open it from within your own app by calling:

    Objective-C:

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"x-apple-health://"]];
    

    Swift:

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

    See Open Health app using url scheme | Apple Developer Forums.

提交回复
热议问题