I recently added the WatchKit Extension to our iOS App. I was programming for a one day when I decided to include the HealthKit in both the iOS App and WatchOS App.So I added the corresponding capabilities to the iOS Target and watchKit Extension Target. Whereas everything went fine with the iOS Target, I experienced some problems with the watch extension target. For some reason the Provisioning Profile for the watchOS target was not updated (it lagged one day behind - 20.02.2020, whereas the iOS target had an provisioning profile of the current date: 21.02.2020), although both were managed automatically by Xcode. The provisioning profile from the watchOS target, the one that was lagging one day behind, was also missing the capabilities and and the two corresponding entitlements of the HealthKit.Furthermore the following error were displayed in the watch Extension target screen: "Failed to register bundle identifier. The app identifier "[...].watchkitapp.watchkitextension could not be registered to your development team. Change your bundle identifier to a unique String to try again." (I don't want to change the bundle id since the iOS app is already live).The identifier of the [...].watchapp.extension does not appear in my identifiers in the apple developer account. When I tried to create the identifier myself, using the bundle identifier notation for the watch app extension, I received an error that the bundle id already exists (Hopefully that is me).So the current situation is: HealthKit is enabled on the iOS target, but won't do so on the watchOS target. it simply says that the bundle identfier does not match up, which is not possible. It further seams that the provisioning profile of the (automatically managed) watch OS profile is not up to date. After I add the capabilities in the watchOS target, Xcode does not generate the new profile but keeps hands on the initial profile from the day I added the watchOS target to the project (the 20.2.2020). For some reason the watchOS app is not registered to my development team, although it belongs to the same project. I did use the "Automatically manage signing" option to build both apps. When everything else failed I was trying to then add the capabilities manually, but could not find the corresponding provisioning profile of the watchapp in the Identifier section of the developer portal.Things I tried so far and noticed are listed below:the Xcode managed ("automatically signed") Provisioning Profile of the watchkitapp.watchkitextension lags one day behind the Provisioning Profile from the iOS target. Whereas this one misses the capability and 2 entitlements, the latter is up to date. This is also stated by the two other errors:
"Provisioning profile "iOS Team Provisioning Profile: *" doesn't support the HealthKit capability.""Provisioning profile "iOS Team Provisioning Profile: *" doesn't include the com.apple.developer.healthkit and com.apple.developer.healthkit.access entitlements."In the Apple Developer account I can find the iOS identifier and the watchapp identifier. However, the watchkitapp.watchkitextension identifier is missing and cannot be added manuelly, as it is already taken, thus not unique. I don't know how though.Downloading the provisioning profiles manuelly did not do the job.Removing and adding the watchapp target to the project did reproduce the same error.The app is already running in the Store, so changing the identifier/bundle Id is not an option.When I remove the healthKit capability, everything works fine. I can run it on my devices and even upload it to the store.