简体   繁体   中英

How to read Heart rate in interval of every 10 minutes using healthkit in AppleWatch Swift

I want to build an iWatch App to read Heart rate in every 10 minutes & notify if it crosses certain boundary using Swift .

I am very new to entire iOS environment and following documentation I was able to achieve through authorising the App but in iPhone not in Watch.

will the coding be same with both the platform ?

Regarding reading the heart rate, as I am working through Simulator, no physical device, so its like I need to enter mock data in the Health App , and then my App will read the mock data to determine the heart rate ?

Am I going in right direction ?

One thing to keep in mind is there is no way to "wake up" the Apple Watch and have it do any processing. Once the user lowers their wrist and the screen turns off, everything executing on your watch app is suspended.

You can use:

NSTimer.ScheduledTimerWithTimeInterval(...)

Reference

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