How can I upload an independent watchOS application that requires a privacy description in the Info.plist?

Hi,


I created an independent watchOS application (without an iOS counterpart) So I have three targets created by Xcode:


- MyApp (which has no linked folder)

- MyApp WatchKit App

- MyApp WatchKit Extension


No my app requires the use of HealthKit, so I added the `NSHealthShareUsageDescription ` to the Info.plist belonging to the Extension target. But when I try to uploade the application to App Store Connect (through Xcode), I get the following error message:


"Invalid Info.plist key. The key 'NSHealthShareUsageDescription' in bundle MyApp.app/Watch/MyApp WatchKit App.app is invalid."


I tried adding the key to the Info.plist of the App target, but this gave errors after the upload completed...


Anyone tried this before? Maybe this issue is resolved with the new Transporter app, but when this will arrive is a mistery...

Accepted Reply

I finally managed to get it working. It turned out the sollution wasn't hard too hard.


I have three targets defined that contain a plist:

  • MyApp
  • MyApp WatchkKit App (with an Info.plist)
  • MyApp WatchkKit Extension (with an Info.plist that contains permission descriptions)


I added an extra Info.plist file that belongs to the 'MyApp' target. This plist only contained the same HealthKit permission descriptions as the 'MyApp WatchkKit Extension'.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>NSHealthShareUsageDescription</key>
  <string>MyApp will use your Health data.</string>
  <key>NSHealthUpdateUsageDescription</key>
  <string>MyApp will save the workout data to Health.</string>
</dict>
</plist>


Hope this helps out someone.

Replies

I faced the same problem, followed all the described steps and still not working. Thats because the Info.plist for the App Container was created by XCode every time I archived the build. But when I deactivated automatic creation, it did not take my provided Info.plist file and build was not finished.

So I ended up activating automatic creation again and archived my build. I then searched for my archived build and opened up the Info.plist file under /Products/Applications/Appname in this package. And yes, still no privacy entries in there. I then added the privacy entries by hand, saved and closed the package and finally this archive was accepted by apple without further warnings or errors.


Hope that helps!

In case of my standalone WatchOS app with access to Health Kit this helped (I learned it from the previous posts from fousa):
  1. I added the keys "Privacy - Health Share Usage Description" and "Privacy - Health Update Usage Description" with some text as values in the file Info.plist in the folder [MyApp] WatchKit Extension.

  2. Then I created another folder [MyApp] on the same level as the folder [MyApp] WatchKit Extension.

  3. I copied the Info.plist file from the folder [MyApp] WatchKit Extension to the new folder [MyApp] and deleted all keys except the two mentioned above.

  4. Then under Targets (you get there when you click on your project name in the Project Navigator on the top of the left side in Xcode), I clicked on the first target (MyApp) and under Packaging for the key "Info.plist File" I added the path to the new Info.plist file - [Myapp]/Info.plist

I cleaned the build folder and got an error when I tried to build again (under top menu Product - Build) - some new error:
(error: Multiple commands produce '[...]/Info.plist': [...]

I restarted XCode, cleaned the build folder again and clicked on Build again. This time I was asked if it was ok if something was cleaned and I accepted.

Then it worked.

Note: In the past, I also had the keys mentioned above in the Info.plist file in [MyApp] WatchKit App and as I remember it caused problems. So in that file I do not have these two keys anymore.

For folks who are unable to use the 2nd Info.plist file approach, I managed to upload to AppStore by configuring the Build Settings of the main target (not the watch target). There is an Info.plist Values section in the build settings (Xcode 14) and you can enter your privacy description text there. (no need for extra Info.plist file. Hope this helps.