Custom Exported Workout missing workoutPlan identifier / Metadata only on the very first app launch/install

Hello everyone,

I am experiencing a strange issue regarding retrieving a custom tracking identifier (workoutPlan identifier) from a custom exported workout that has been imported via HealthKit.

The Issue:

  • First Fresh Install: When the app is installed for the first time and initialized, it fails to load/fetch the workout plan ID from the imported workout.

  • Subsequent Launches / Re-installs: If I close and relaunch the app, the app successfully fetches the workout plan ID from HealthKit with absolutely no problems.

Has anyone found a clean way to handle this without forcing a manual user refresh or an awkward delay/retry mechanism on the first launch?

Any insight, workarounds, or best practices would be greatly appreciated!

Environment: iOS 17+, Swift, HealthKit

This is a dup to this post that I have replied. Let's follow up there.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Custom Exported Workout missing workoutPlan identifier / Metadata only on the very first app launch/install
 
 
Q