iOS universal app with healthkit won't run on

2019-02-01 23:45发布

问题:

I have an universal app and I´ve implemented it to use the healthkit API. It runs great on iPhone but when I try to install it on an actual iPad device (works perfectly in iPad simulator) it wont install.

I am getting the error message: "The Info.plist for application at ... specifies device capability requirements, which are not met by "my ipad"".

I there any way I can distribute an universal app where the healthkit API (framework) only runs on the iPhone?

Heres two screenshots of my project:

Do I really need to make a standalone iPad app?

回答1:

you can remove healthkit from "Required device capabilities" in your project's info.plist



回答2:

Only by removing healthkit from Required device capabilities from info.plist doesn't work.

If you do only above step then apple reject the app with below message.

Your app uses the HealthKit API but does not indicate integration with the Health app in your app description.

You need to do below steps to run your app in both iPhone & iPad.

1. Remove healthkit from Required device capabilities from info.plist

2. You need to set HealthKit.framework as Optional from Linked Frameworks and Libraries



回答3:

Seems like you can't use HealthKit on the iPad:

From the HealthKit Framework Reference:

Both HealthKit and the Health app are unavailable on iPad. The HealthKit framework cannot be used in an app extension.



回答4:

From Apple documentation: https://developer.apple.com/reference/healthkit

HealthKit and the Health app are unavailable on iPad.

When you enable the HealthKit capabilities on an iOS app, Xcode adds HealthKit to the list of required device capabilities. This prevents users from purchasing or installing the app on devices that do not support HealthKit.

The two statements together imply that if you add HealthKit capabilities to your app, user will not be able to install your app on iPad.

It can be found in the Device Compatibility Matrix as well: https://developer.apple.com/library/content/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/DeviceCompatibilityMatrix/DeviceCompatibilityMatrix.html