HealthKit Error Code=3

I am currently receiving the following issue when my app requests access to the mindful minutes store:


Error Domain=com.apple.healthkit Code=3 "Failed to look up source with bundle identifier "com.myorg.myapp"" 
UserInfo={NSLocalizedDescription=Failed to look up source with bundle identifier "com.myorg.myapp"}


The app does not crash however the authentication page does not in fact display.


This is strange because this was working perfectly in previous versions of my app (since which I have made very few alterations).


The following is the code I am using to request the authentication:


let typesToShare = Set([
  HKObjectType.categoryType(forIdentifier: HKCategoryTypeIdentifier.mindfulSession)!
])

self.healthStore.requestAuthorization(toShare: typesToShare, read: nil) { (_, error) -> Void in
  if let error = error {
  print("\(error)")
  }

  DispatchQueue.main.async {
  self.performSegue(withIdentifier: "openWalkthroughThree", sender: self)
  }
}


Initially, I thought this was an issue with code signing. However, I have completely refreshed all my certificates and it still is not working.


I would greatly appreciate a nudge in the right direction to solve this issue (specifically what the error actually is).

Post not yet marked as solved Up vote post of kara12321 Down vote post of kara12321
1.5k views

Replies

Greetings from 2022. I have now the exact same thing happen to me. Do you have an update you can share on if you were able to solve this issue?

Hello from 2023. Rebooting the phone and xcode fixed it for me