I am working on a watch app which requests permissions to read and write active calorie data. My app works fine on Xcode 8 and watchOS3 + iOS 10, but on Xcode 9 and watchOS4 + iOS 11, I am unable request health kit permissions.
When I call requestAuthorization on HKHealthStore I get back success = false and the following error:
Error Domain=com.apple.healthkit Code=5 "Transaction block failed without an error." UserInfo={NSLocalizedDescription=Transaction block failed without an error.}
I also do not receive the alert on my phone to open my app and accept / decline the request for permissions.
My entitlements are setup correctly with com.apple.developer.healthkit set to YES for both the app and the watch extension. Since it worked fine when building to device on Xcode 8 and watchOS3 + iOS 10, but now no longer works on Xcode 9 and watchOS4 + iOS 11, my guess is that it's an SDK bug.
I encountered the same bug on the simulator, which I seemed to fix by erasing all content and settings, but I really don't want to have to do that on my actual device.
Any assistance from the Apple development team would be much appreciated. Since I never even get the alert on my phone, nor the alert on my watch to go to my phone to accept the permissions, my guess is that there's some bad state a device can get in where requestAuthorization on HKHealthStore just gets borked.