我无法从微软带获取心率数据。我的iOS应用程序上显示心率文本标签不会更改。 (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];
}];
}
答案 0 :(得分:2)
从Band访问心率数据需要一次性用户同意。以下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;
上述API的示例代码可在Band SDK documentation(第2.4.1.2节)中找到。