How to solve this error with healthkit?

后端 未结 6 984
臣服心动
臣服心动 2021-02-04 20:04

I\'m adding code for healthkit in my ios Swift app, but I\'m getting an error...

 /* Ask for permission to access the health store */
override func viewDidAppear         


        
6条回答
  •  生来不讨喜
    2021-02-04 20:22

    Some additional info that might help. If, under the HealthKit Capabilities the first step "add health kit entitlement to your app id" shows an error, and you have a "Fix This" button which does not do the job... read on...

    Many times after working on multiple HealthKit test projects, you may find you have a Bundle ID that matches another Bundle ID used with another HealthKit project (say you duplicated the one project to spin off another test). This contention will show up as an error under the first checkmark in "iOS dev"s picture "add health kit entitlement to your app id". The error listed in the capabilities section unfortunately calls it an "app id" when you need to change the "Bundle ID". Add a number (or some character) in your bundle id string to make it unique. Then the "Fix" button in the HealthKit capabilities settings will work.

    The Bundle ID (aka "App ID") is found under the "General" tab to the left of the "Capabilities" tab.

提交回复
热议问题