简体   繁体   中英

Apple watch HealthKit - unrecognized selector HKHealthStore startWorkoutSession:completion:

I try to get heart rate with watch OS2.0 I get this error when i try to start the workout session

Carleep WatchKit Extension[594:91719] -[HKHealthStore startWorkoutSession:completion:]: unrecognized selector sent to instance 0x155b40e0
  • I well added healthkit framework to my project.
  • I added -all_load and -ObjC in Other linker flags
  • I find this function in healthkit framework when i cmd+click on startWorkoutSession...
  • I have iOS 9 and apple watch under watchOS 2.0

I succeed to request authorization for heartRate. I don't know if i need force import of HKHealthstore+HKWorkout category, and i don't know how to do this.

If you have an idea about my problem and how to solve this it would be great.

Regards,

Ok i found the solution, i just update Xcode 7 to the latest beta version (6). They removed the completion block in startworkoutsession in the last beta of watch os2. My sdk for watch os 2 in Xcode 7 beta 3 was outdated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM