Sağlık kitinde kan basıncı verisi kaydedilir.iOS'ta sağlık kiti uygulamasında kan basıncı verilerini nasıl kaydedersiniz
- (void)viewDidLoad {
Systolic = 120;
Diastolic = 90;
[[GSHealthKitManager sharedManager]saveBloodPressureIntoHealthStore:Systolic Dysbp:Diastolic];
}
- (void)saveBloodPressureIntoHealthStore:(double)Systolic Dysbp: (double)Diastolic {
HKUnit *BloodPressureUnit = [HKUnit millimeterOfMercuryUnit];
HKQuantity *SystolicQuantity = [HKQuantity quantityWithUnit:BloodPressureUnit doubleValue:Systolic];
HKQuantity *DiastolicQuantity = [HKQuantity quantityWithUnit:BloodPressureUnit doubleValue:Diastolic];
HKQuantityType *SystolicType = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierBloodPressureSystolic];
HKQuantityType *DiastolicType = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierBloodPressureDiastolic];
NSDate *now = [NSDate date];
HKQuantitySample *SystolicSample = [HKQuantitySample quantitySampleWithType:SystolicType quantity:SystolicQuantity startDate:now endDate:now];
HKQuantitySample *DiastolicSample = [HKQuantitySample quantitySampleWithType:DiastolicType quantity:DiastolicQuantity startDate:now endDate:now];
NSSet *objects=[NSSet setWithObjects:SystolicSample,DiastolicSample, nil];
HKCorrelationType *bloodPressureType = [HKObjectType correlationTypeForIdentifier:HKCorrelationTypeIdentifierBloodPressure];
HKCorrelation *BloodPressure = [HKCorrelation correlationWithType:bloodPressureType startDate:now endDate:now objects:objects];
[self.healthStore saveObject:BloodPressure withCompletion:^(BOOL success, NSError *error) {
if (!success) {
NSLog(@"An error occured saving the height sample %@. In your app, try to handle this gracefully. The error was: %@.", BloodPressure, error);
abort();
}
UIAlertView *savealert=[[UIAlertView alloc]initWithTitle:@"HealthDemo" message:@"Blood Pressure values has been saved to Health App" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[savealert show];
}];
}
Uygulamamı çalıştırırsam, abort(); fonksiyon
An error occurred saving the height sample <HKCorrelation> 2016-04-06 14:42:47 +0530 2016-04-06 14:42:47 +0530 (2 objects). In your app, try to handle this gracefully. The error was: Error Domain=com.apple.healthkit Code=5 "Authorization is not determined" UserInfo={NSLocalizedDescription=Authorization is not determined}.
Eğer HealthKit kullanıcıdan çok erişmek için yetki istedi mi? – Larme
@Larme Cevabınız için teşekkür ederiz. anlamıyorum kardeşim ne anlama geliyor .. aslında sağlık kiti uygulamasında ben gösteride kan basıncını etkinleştirebilirim Kontrol Paneli – satya
Farklı iOS çerçevelerini kullanırken kullanabilmek için kullanıcıdan izin alması oldukça yaygın. HealthKit hakkında bir şey okumadım, ama eminim bunlar bunu kapsamaktadır. HealtKit hakkında birşeyler okumak zorunda mısınız? Kodu aldığınızdan hayır diyorum (http://stackoverflow.com/questions/25642949/for-ios-healthkit-how-to-save-systolic-and-diastolic-blood-pressure-values) ve herhangi bir şey okumadan dümdüz dümdüz, ben bahse girerim ... – trojanfoe