[英]Access to Heart Rate data from microsoft-band with iOS SDKs
I'm having trouble getting heart rate data from microsoft-band. 我无法从微软带获取心率数据。 It appears on my iOS app that the heart rate text label won't change.
我的iOS应用程序上显示心率文本标签不会更改。 (
CoreBluetooth
frame has been added). (已添加
CoreBluetooth
框架)。
if (self.client && self.client.isDeviceConnected){
[self output:@"Starting Heart Rate updates..."];
[self.client.sensorManager startHeartRateUpdatesToQueue:nil errorRef:nil withHandler:^(MSBSensorHeartRateData *heartRateData, NSError *error) {
self.heartRateLabel.text = [NSString stringWithFormat:@"Heart Rate: %d bpm", heartRateData.heartRate];
}];
}
Accessing heart rate data from the Band requires a one-time user consent. 从Band访问心率数据需要一次性用户同意。 The following API can be used to request and check user consent:
以下API可用于请求和检查用户同意:
/**
* Check user consent for heart rate.
* @return MSBSensorUserConsent Returns a MSBSensorUserConsent value based on user consent.
*/
- (MSBUserConsent)heartRateUserConsent;
/**
* Request user consent for heart rate.
* @param completion Completion block to invoke with the user response.
*/
- (void)requestHRUserConsentWithCompletion:(void (^)(BOOL userConsent, NSError *error))completion;
Sample code for above API can be found in the Band SDK documentation (Section 2.4.1.2). 可以在Band SDK文档 (第2.4.1.2节)中找到上述API的示例代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.