From ae5c0366771828d52fd00b9f7001309ce2b99d24 Mon Sep 17 00:00:00 2001 From: Chris Schaefbauer Date: Fri, 12 Jun 2015 10:39:48 -0600 Subject: [PATCH] Remove warnings for pod validation --- Pod/Classes/OMHHealthKitConstantsMapper.h | 1 - Pod/Classes/OMHHealthKitConstantsMapper.m | 8 ++++++++ Pod/Classes/OMHSerializer.m | 8 ++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Pod/Classes/OMHHealthKitConstantsMapper.h b/Pod/Classes/OMHHealthKitConstantsMapper.h index 3bcd575..afca124 100644 --- a/Pod/Classes/OMHHealthKitConstantsMapper.h +++ b/Pod/Classes/OMHHealthKitConstantsMapper.h @@ -18,6 +18,5 @@ + (NSString*) stringForHKWorkoutActivityType:(int) enumValue; + (NSString*) stringForHKSleepAnalysisValue:(int) enumValue; -+ (NSDictionary*) dictionaryForTypeIdentifiersToClasses; @end diff --git a/Pod/Classes/OMHHealthKitConstantsMapper.m b/Pod/Classes/OMHHealthKitConstantsMapper.m index e698bdb..9df7e43 100644 --- a/Pod/Classes/OMHHealthKitConstantsMapper.m +++ b/Pod/Classes/OMHHealthKitConstantsMapper.m @@ -150,6 +150,14 @@ + (NSString*) stringForHKSleepAnalysisValue:(int) enumValue{ case HKCategoryValueSleepAnalysisAsleep: return @"Asleep"; break; + default:{ + NSException *e = [NSException + exceptionWithName:@"KCategoryValueSleepAnalysisInvalidValue" + reason:@"KCategoryValueSleepAnalysis can only have a HKCategoryValueSleepAnalysisInBed or HKCategoryValueSleepAnalysisAsleep value" + userInfo:nil]; + @throw e; + } + } } diff --git a/Pod/Classes/OMHSerializer.m b/Pod/Classes/OMHSerializer.m index 091e04b..322dc6f 100644 --- a/Pod/Classes/OMHSerializer.m +++ b/Pod/Classes/OMHSerializer.m @@ -832,10 +832,10 @@ @interface OMHSerializerGenericWorkout : OMHSerializer; @end @implementation OMHSerializerGenericWorkout + (BOOL)canSerialize:(HKSample *)sample error:(NSError *__autoreleasing *)error { - @try{ - HKWorkout *workoutSample = (HKWorkout*)sample; + if([sample isKindOfClass:[HKWorkout class]]){ + return YES; } - @catch (NSException *exception){ + else{ if (error) { NSString* errorMessage = @"OMHSerializerGenericWorkout is used for HKWorkout samples only"; @@ -846,7 +846,7 @@ + (BOOL)canSerialize:(HKSample *)sample error:(NSError *__autoreleasing *)error } return NO; } - return YES; + } - (id)bodyData {