2
votes

Has anyone combined these two new features in iOS8 yet? I'm attempting to access HealthKit from a widget. But since the application and extension use two separate App IDs - the widget automatically rejects access to HealthKit. The Notification Center/Today view doesn't display any prompt to allow access. I notice it attempts to because I see an "unbalanced view controller transition" warning in the console, but nothing is displayed.

For a manual fix - the Health app will display the bundle ID with permissions that can be manually changed. However, there's no app icon and the extension is listed as its bundle ID and not listed as its product name. This makes me think this is still something they are working on in the beta.

3
If you have skype, contact me, I'm working on a same type of thing and we can sort of figure a workaround. Maybe beta 6 has a fix, but we don't have that sdk :/Schemetrical
Sure, I would like to hear your workaround - what's your Skype?Sean
same as my SO username. I haven't found a workaround yet but looking into it :pSchemetrical

3 Answers

2
votes

You could try to access the HealthKit data from your containing app and then share those data with your extension through App Group.

I haven't looked at HealthKit yet, but in another case the App Group feature worked fine for me.

1
votes

I haven't tried doing this type of combination between those features in my app yet, but while integrating the HealthKit capabilities, I happened to see the following in HealthKit documentations:

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

So I assume a direct way is not available... You can read more here: HealthKit_Framework Documentation

0
votes

You won't be able to access HealthKit. To quote Apple's App Extension Programming Guide:

Some APIs Are Unavailable to App Extensions

Because of its focused role in the system, an app extension is ineligible to participate in certain activities. An app extension cannot: …

Use any API marked in header files with the NS_EXTENSION_UNAVAILABLE macro, or similar unavailability macro, or any API in an unavailable framework

For example, in iOS 8.0, the HealthKit framework and EventKit UI framework are unavailable to app extensions.

[emphasis added.]