ios,swift,health-kit,hkhealthstore
For both healthKitTypesToRead and healthKitTypesToWrite, you are creating an NSSet that contains an array of HKObjectTypes. It should be an NSSet of HKObjectTypes without the array. Also note that your code snippet is not using healthKitTypesToWrite. If it were, though, that set should not contain any HKCharacteristicTypes. HealthKit does not...
ios,swift,health-kit,hkhealthstore
You are encountering a known issue with HealthKit. You can work around the bug by explicitly creating an NSDictionary for your metadata instead of a Swift dictionary.
Unfortunately, no. There is no way to access HealthKit store data while the phone is locked as stated in the documentation and confirmed in the comments of this SO post.
ios,background-process,health-kit,hkhealthstore
As stated in the documentation you quoted there's no way to access HealthKit data while the phone is locked. However, you can access the data if the phone is unlocked and your app is in the background. So if background fetch happens while the phone is unlocked you will be...