I am following chapter 23. I downloaded the Groundhog starter project. This is what the books says at page 419:
“Open Groundhog.xcodeproj and have a look around. The app contains a working version of a watch interval timer as well as a simple iOS app that allows you to see your recorded workouts. You won’t see any data yet in the iOS app, as you’ve not yet recorded any data to HealthKit.
Choose the Groundhog WatchKit App scheme, and build and run. It will look like this:”
I changed the team of all the 3 targets, although it’s not mentioned anywhere. However, the project still not works. This is the error I get:
How to fix that?
@fathousesw Could you please help with this when you get a chance? Thank you - much appreciated! :]
@ramy Are you logged into your Apple Developer account via Xcode Preferences > Accounts? Also, I’d recommend that you change the bundle identifiers. The bundle identifier is supposed to be unique for you and your app. Try to change that to something like
com.ramy.Groundhog.... Xcode is asking you change those bundle identifiers to a unique string. If you’re already logged into your Apple Developer account, Xcode should be able to creat the appropriate App IDs in the portal (Sign In - Apple), and generate provisioning profiles.
Sorry you’re having trouble with the Healthkit chapter! I think what’s happening is that you opened the Final project instead of the Starter project. If you Build and Run the starter project, you should get a working version of a watchOS app that simply implements an interval timer.
The errors you show above suggests that the HealthKit capability has been enabled; which should only be the case in the Final project. If you want to see the Final project running using HealthKit without walking through all the steps outlined in the chapter, you will need to do the first step of the Provisioning for HealthKit section of the chapter.
Select the Groundhog project from the project navigator and then select the Groundhog project in the editor. Select the Build Settings tab and scroll to the very bottom. You’ll see a user-defined variable named
W3T_BUNDLE_PREFIX. Select the existing value and enter your own. Any string will do, but generally, it’s best to use your domain in reverse order.
This will change the bundle identifiers for each target in the project so that they use your own prefix, making them unique.
You may also, then, have to switch the team for each project, but it is generally not necessary.
Finally, please note:
To provision your app correctly and use HealthKit, you must have a valid Apple Developer account. If you don’t have a valid account, the HealthKit permission requests will fail.
If you have any other questions, feel free to reply, and I’ll see if I can help you out.
Thanks for reading!
Yes you’re right, it was the W3T_BUNDLE_PREFIX. It didn’t accept the already set value, I had to change it. Thank you for your replies.
@ramy Good. I’m glad that worked out for you!
FWIW: It didn’t accept the
com.raywenderlich value because
com.raywenderlich.Groundhog was an already existing Bundle Identifier in the app store. The identifiers have to be unique throughout the app store. And, during the development of this chapter, we would have created that one.
I have a similar warning:
Groundhog Extension[37468:677296] [default] containerAppExtensionEntitlementsWithCompletion: failed with error: (null).
If I execute the final proyect and change the group, I have the same error
This topic was automatically closed after 166 days. New replies are no longer allowed.