From f1efac6092a6031f88a5b2fc76c623a0e003c0e8 Mon Sep 17 00:00:00 2001 From: Andreas Amsenius Date: Thu, 13 Dec 2018 15:51:25 +0100 Subject: [PATCH] Don't allocate healthstore more than once --- RCTAppleHealthKit/RCTAppleHealthKit.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RCTAppleHealthKit/RCTAppleHealthKit.m b/RCTAppleHealthKit/RCTAppleHealthKit.m index ba8d48d..8f10345 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit.m +++ b/RCTAppleHealthKit/RCTAppleHealthKit.m @@ -270,7 +270,9 @@ RCT_EXPORT_METHOD(authorizationStatusForType:(NSString *)type resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject { - self.healthStore = [[HKHealthStore alloc] init]; + if (self.healthStore == nil) { + self.healthStore = [[HKHealthStore alloc] init]; + } if ([HKHealthStore isHealthDataAvailable]) { HKObjectType *objectType = [self getWritePermFromString:type]; -- 2.26.2