diff --git a/Pods/JLAuthorizationManager/JLAuthorizationManager/JLAuthorizationManager.m b/Pods/JLAuthorizationManager/JLAuthorizationManager/JLAuthorizationManager.m index 53582b7..146e0e5 100644 --- a/Pods/JLAuthorizationManager/JLAuthorizationManager/JLAuthorizationManager.m +++ b/Pods/JLAuthorizationManager/JLAuthorizationManager/JLAuthorizationManager.m @@ -22,7 +22,7 @@ @import CoreLocation; @import MediaPlayer; @import Speech;//Xcode 8.0 or later -@import HealthKit; +//@import HealthKit; @import Intents; @import CoreBluetooth; @@ -30,102 +30,102 @@ #define IOS9 ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 9.0) #define IOS10 ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 10.0) -@interface JLAuthorizationHealthManager : NSObject +//@interface JLAuthorizationHealthManager : NSObject -- (void)JL_requestHealthAuthorizationWithShareTypes:(nullable NSSet *)typesToShare - readTypes:(nullable NSSet *)typesToRead - authorizedHandler:(void(^)())authorizedHandler - unAuthorizedHandler:(void(^)())unAuthorizedHandler; -@end - -@implementation JLAuthorizationHealthManager - -- (void)JL_requestHealthAuthorizationWithShareTypes:(nullable NSSet *)typesToShare - readTypes:(nullable NSSet *)typesToRead - authorizedHandler:(void(^)())authorizedHandler - unAuthorizedHandler:(void(^)())unAuthorizedHandler{ +//- (void)JL_requestHealthAuthorizationWithShareTypes:(nullable NSSet *)typesToShare +// readTypes:(nullable NSSet *)typesToRead +// authorizedHandler:(void(^)())authorizedHandler +// unAuthorizedHandler:(void(^)())unAuthorizedHandler; +//@end +// +//@implementation JLAuthorizationHealthManager - HKHealthStore *healthStore = [[HKHealthStore alloc] init]; - __block BOOL shouldRequestAccess = NO; - if (typesToShare.count > 0) { - - [typesToShare enumerateObjectsUsingBlock:^(HKObjectType * _Nonnull type, BOOL * _Nonnull stop) { - HKAuthorizationStatus authStatus = [healthStore authorizationStatusForType:type]; - if (authStatus == HKAuthorizationStatusNotDetermined) { - shouldRequestAccess = YES; - *stop = YES; - } - }]; - - }else{ - if (typesToRead.count > 0) { - - [typesToRead enumerateObjectsUsingBlock:^(HKObjectType * _Nonnull type, BOOL * _Nonnull stop) { - HKAuthorizationStatus authStatus = [healthStore authorizationStatusForType:type]; - if (authStatus == HKAuthorizationStatusNotDetermined) { - shouldRequestAccess = YES; - *stop = YES; - } - }]; - - - }else{ - NSAssert(!(typesToRead.count > 0), @"待请求的权限类型数组不能为空"); - } - } - - if (shouldRequestAccess) { - [healthStore requestAuthorizationToShareTypes:typesToShare readTypes:typesToRead completion:^(BOOL success, NSError * _Nullable error) { - if (success) { - dispatch_async(dispatch_get_main_queue(), ^{ - authorizedHandler ? authorizedHandler() : nil; - }); - }else{ - dispatch_async(dispatch_get_main_queue(), ^{ - unAuthorizedHandler ? unAuthorizedHandler() : nil; - }); - } - }]; - }else{ - __block BOOL isAuthorized = NO; - if (typesToShare.count > 0) { - [typesToShare enumerateObjectsUsingBlock:^(HKSampleType * _Nonnull type, BOOL * _Nonnull stop) { - HKAuthorizationStatus authStatus = [healthStore authorizationStatusForType:type]; - if (authStatus == HKAuthorizationStatusNotDetermined - || authStatus == HKAuthorizationStatusSharingDenied) { - isAuthorized = NO; - }else{ - isAuthorized = YES; - } - }]; - }else{ - if (typesToRead.count > 0) { - - [typesToRead enumerateObjectsUsingBlock:^(HKObjectType * _Nonnull type, BOOL * _Nonnull stop) { - HKAuthorizationStatus authStatus = [healthStore authorizationStatusForType:type]; - if (authStatus == HKAuthorizationStatusNotDetermined - || authStatus == HKAuthorizationStatusSharingDenied) { - isAuthorized = NO; - }else{ - isAuthorized = YES; - } - }]; - - }else{ - NSAssert(!(typesToRead.count > 0), @"待请求的权限类型数组不能为空"); - } - } - - if (isAuthorized) { - authorizedHandler ? authorizedHandler() : nil; - }else{ - unAuthorizedHandler ? unAuthorizedHandler() : nil; - } - - } - -} -@end +//- (void)JL_requestHealthAuthorizationWithShareTypes:(nullable NSSet *)typesToShare +// readTypes:(nullable NSSet *)typesToRead +// authorizedHandler:(void(^)())authorizedHandler +// unAuthorizedHandler:(void(^)())unAuthorizedHandler{ +// +// HKHealthStore *healthStore = [[HKHealthStore alloc] init]; +// __block BOOL shouldRequestAccess = NO; +// if (typesToShare.count > 0) { +// +// [typesToShare enumerateObjectsUsingBlock:^(HKObjectType * _Nonnull type, BOOL * _Nonnull stop) { +// HKAuthorizationStatus authStatus = [healthStore authorizationStatusForType:type]; +// if (authStatus == HKAuthorizationStatusNotDetermined) { +// shouldRequestAccess = YES; +// *stop = YES; +// } +// }]; +// +// }else{ +// if (typesToRead.count > 0) { +// +// [typesToRead enumerateObjectsUsingBlock:^(HKObjectType * _Nonnull type, BOOL * _Nonnull stop) { +// HKAuthorizationStatus authStatus = [healthStore authorizationStatusForType:type]; +// if (authStatus == HKAuthorizationStatusNotDetermined) { +// shouldRequestAccess = YES; +// *stop = YES; +// } +// }]; +// +// +// }else{ +// NSAssert(!(typesToRead.count > 0), @"待请求的权限类型数组不能为空"); +// } +// } +// +// if (shouldRequestAccess) { +// [healthStore requestAuthorizationToShareTypes:typesToShare readTypes:typesToRead completion:^(BOOL success, NSError * _Nullable error) { +// if (success) { +// dispatch_async(dispatch_get_main_queue(), ^{ +// authorizedHandler ? authorizedHandler() : nil; +// }); +// }else{ +// dispatch_async(dispatch_get_main_queue(), ^{ +// unAuthorizedHandler ? unAuthorizedHandler() : nil; +// }); +// } +// }]; +// }else{ +// __block BOOL isAuthorized = NO; +// if (typesToShare.count > 0) { +// [typesToShare enumerateObjectsUsingBlock:^(HKSampleType * _Nonnull type, BOOL * _Nonnull stop) { +// HKAuthorizationStatus authStatus = [healthStore authorizationStatusForType:type]; +// if (authStatus == HKAuthorizationStatusNotDetermined +// || authStatus == HKAuthorizationStatusSharingDenied) { +// isAuthorized = NO; +// }else{ +// isAuthorized = YES; +// } +// }]; +// }else{ +// if (typesToRead.count > 0) { +// +// [typesToRead enumerateObjectsUsingBlock:^(HKObjectType * _Nonnull type, BOOL * _Nonnull stop) { +// HKAuthorizationStatus authStatus = [healthStore authorizationStatusForType:type]; +// if (authStatus == HKAuthorizationStatusNotDetermined +// || authStatus == HKAuthorizationStatusSharingDenied) { +// isAuthorized = NO; +// }else{ +// isAuthorized = YES; +// } +// }]; +// +// }else{ +// NSAssert(!(typesToRead.count > 0), @"待请求的权限类型数组不能为空"); +// } +// } +// +// if (isAuthorized) { +// authorizedHandler ? authorizedHandler() : nil; +// }else{ +// unAuthorizedHandler ? unAuthorizedHandler() : nil; +// } +// +// } +// +//} +//@end @interface JLAuthorizationManager () @@ -226,19 +226,19 @@ } } -- (void)JL_requestHealthAuthorizationWithShareTypes:(NSSet*)typesToShare - readTypes:(NSSet*)typesToRead - authorizedHandler:(void(^)())authorizedHandler - unAuthorizedHandler:(void(^)())unAuthorizedHandler{ - - JLAuthorizationHealthManager *healthManager = [JLAuthorizationHealthManager new]; - [healthManager JL_requestHealthAuthorizationWithShareTypes:typesToShare - readTypes:typesToRead - authorizedHandler:authorizedHandler - unAuthorizedHandler:unAuthorizedHandler]; - - -} +//- (void)JL_requestHealthAuthorizationWithShareTypes:(NSSet*)typesToShare +// readTypes:(NSSet*)typesToRead +// authorizedHandler:(void(^)())authorizedHandler +// unAuthorizedHandler:(void(^)())unAuthorizedHandler{ +// +// JLAuthorizationHealthManager *healthManager = [JLAuthorizationHealthManager new]; +// [healthManager JL_requestHealthAuthorizationWithShareTypes:typesToShare +// readTypes:typesToRead +// authorizedHandler:authorizedHandler +// unAuthorizedHandler:unAuthorizedHandler]; +// +// +//} #pragma mark - Photo Library - (void)p_requestPhotoLibraryAccessWithAuthorizedHandler:(void(^)())authorizedHandler diff --git a/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate b/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate index aae3799..71c2831 100644 Binary files a/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate and b/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/tongxin/Info.plist b/tongxin/Info.plist index c3cb997..566fbe0 100644 --- a/tongxin/Info.plist +++ b/tongxin/Info.plist @@ -148,10 +148,6 @@ 请为应用打开相机权限,以便使用二维码扫描功能 NSContactsUsageDescription 请为应用打开通讯录权限,以便使用联系人批量导入功能 - NSHealthShareUsageDescription - App需要您的同意,才能访问健康分享 - NSHealthUpdateUsageDescription - App需要您的同意,才能访问健康更新 NSLocationAlwaysAndWhenInUseUsageDescription 是否允许在使用过程中获取您的定位信息用于查看位置信息 NSLocationAlwaysUsageDescription