From c2e8e4f28a649a647098321d3cd95a0b55312e87 Mon Sep 17 00:00:00 2001 From: Sergey Kuryanov Date: Tue, 10 Jul 2018 18:56:02 +0300 Subject: [PATCH 1/4] Update Mantle pod --- .../project.pbxproj | 61 ++++--------------- librato-iOS.podspec | 2 +- 2 files changed, 12 insertions(+), 51 deletions(-) diff --git a/Demo/librato-iOS Demo.xcodeproj/project.pbxproj b/Demo/librato-iOS Demo.xcodeproj/project.pbxproj index cbfbc7c..aad2363 100644 --- a/Demo/librato-iOS Demo.xcodeproj/project.pbxproj +++ b/Demo/librato-iOS Demo.xcodeproj/project.pbxproj @@ -193,7 +193,6 @@ 66922617180358AF00237E77 /* Frameworks */, 66922618180358AF00237E77 /* Resources */, CF311E2286F14B79A814F7BE /* [CP] Copy Pods Resources */, - 49278725AA6A48415323BBF8 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -212,8 +211,6 @@ 66922631180358AF00237E77 /* Sources */, 66922632180358AF00237E77 /* Frameworks */, 66922633180358AF00237E77 /* Resources */, - BAACFE891AE2BDA71802DAB9 /* [CP] Embed Pods Frameworks */, - B8F1461E083D696A5571BDE5 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -280,34 +277,22 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 49278725AA6A48415323BBF8 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-librato-iOS Demo/Pods-librato-iOS Demo-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 56571786C5174A36B0BB4AC8 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-librato-iOS Demo-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 60F4CC329F21EB0D532804DC /* [CP] Check Pods Manifest.lock */ = { @@ -316,43 +301,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-librato-iOS DemoTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - B8F1461E083D696A5571BDE5 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-librato-iOS DemoTests/Pods-librato-iOS DemoTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - BAACFE891AE2BDA71802DAB9 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-librato-iOS DemoTests/Pods-librato-iOS DemoTests-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; CF311E2286F14B79A814F7BE /* [CP] Copy Pods Resources */ = { @@ -361,9 +319,12 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-librato-iOS Demo/Pods-librato-iOS Demo-resources.sh", + "${PODS_ROOT}/../../librato-iOS/Librato-Localizable.strings", ); name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Librato-Localizable.strings", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/librato-iOS.podspec b/librato-iOS.podspec index 2c99b2e..367ce76 100644 --- a/librato-iOS.podspec +++ b/librato-iOS.podspec @@ -18,5 +18,5 @@ Pod::Spec.new do |s| s.requires_arc = true s.dependency 'AFNetworking', '~> 2.0' - s.dependency 'Mantle', '~> 1.3' + s.dependency 'Mantle', '~> 2.1' end From 2783d2697f31545a4ab37580bb4ae30f80031dcd Mon Sep 17 00:00:00 2001 From: Sergey Kuryanov Date: Tue, 10 Jul 2018 18:56:21 +0300 Subject: [PATCH 2/4] Replace deprecated methods --- librato-iOS/Metrics/LibratoMetric.m | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/librato-iOS/Metrics/LibratoMetric.m b/librato-iOS/Metrics/LibratoMetric.m index c5a2885..ed7b44a 100644 --- a/librato-iOS/Metrics/LibratoMetric.m +++ b/librato-iOS/Metrics/LibratoMetric.m @@ -69,9 +69,9 @@ + (NSDictionary *)JSONKeyPathsByPropertyKey + (NSValueTransformer *)measureTimeJSONTransformer { - return [MTLValueTransformer reversibleTransformerWithForwardBlock:^id(NSNumber *epoch) { + return [MTLValueTransformer transformerUsingForwardBlock:^id(NSNumber *epoch, BOOL *success, NSError **error) { return [NSDate dateWithTimeIntervalSince1970:epoch.integerValue]; - } reverseBlock:^id(NSDate *date) { + } reverseBlock:^id(NSDate *date, BOOL *success, NSError **error) { return @(floor(date.timeIntervalSince1970)); }]; } @@ -79,10 +79,10 @@ + (NSValueTransformer *)measureTimeJSONTransformer + (NSValueTransformer *)nameJSONTransformer { - return [MTLValueTransformer reversibleTransformerWithForwardBlock:^id(NSString *name) { + return [MTLValueTransformer transformerUsingForwardBlock:^id(NSString *name, BOOL *success, NSError **error) { NSAssert(name.length > 0, @"Measurements must be named"); return name.alm_sanitizedForMetric; - } reverseBlock:^id(NSString *name) { + } reverseBlock:^id(NSString *name, BOOL *success, NSError **error) { return name.alm_sanitizedForMetric; }]; } @@ -90,9 +90,9 @@ + (NSValueTransformer *)nameJSONTransformer + (NSValueTransformer *)sourceJSONTransformer { - return [MTLValueTransformer reversibleTransformerWithForwardBlock:^id(NSString *source) { + return [MTLValueTransformer transformerUsingForwardBlock:^id(NSString *source, BOOL *success, NSError **error) { return source.alm_sanitizedForMetric; - } reverseBlock:^id(NSString *source) { + } reverseBlock:^id(NSString *source, BOOL *success, NSError **error) { return (source.length ? source.alm_sanitizedForMetric : nil); }]; } @@ -100,10 +100,10 @@ + (NSValueTransformer *)sourceJSONTransformer + (NSValueTransformer *)valueJSONTransformer { - return [MTLValueTransformer reversibleTransformerWithForwardBlock:^id(NSNumber *value) { + return [MTLValueTransformer transformerUsingForwardBlock:^id(NSNumber *value, BOOL *success, NSError **error) { NSAssert([self.class isValidValue:value], @"Boolean is not a valid metric value"); return value; - } reverseBlock:^id(NSNumber *value) { + } reverseBlock:^id(NSNumber *value, BOOL *success, NSError **error) { return value; }]; } @@ -113,7 +113,7 @@ + (NSValueTransformer *)valueJSONTransformer - (NSDictionary *)JSONDictionary { NSArray *nonNullableKeys = @[@"source"]; - __block NSMutableDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:self].mutableCopy; + __block NSMutableDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:self error:nil].mutableCopy; [nonNullableKeys enumerateObjectsUsingBlock:^(NSString *key, NSUInteger idx, BOOL *stop) { if ([jsonDict.allKeys containsObject:key] && (jsonDict[key] == NSNull.null || jsonDict[key] == nil)) { From dc329abd98df6311c6b16dc815ca55f709b9157d Mon Sep 17 00:00:00 2001 From: Sergey Kuryanov Date: Tue, 10 Jul 2018 20:06:12 +0300 Subject: [PATCH 3/4] Fix assertion failures by removing unused keys. --- librato-iOS/Metrics/LibratoGaugeMetric.m | 4 +--- librato-iOS/Metrics/LibratoMetric.m | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/librato-iOS/Metrics/LibratoGaugeMetric.m b/librato-iOS/Metrics/LibratoGaugeMetric.m index 16ee6df..5de2cbc 100644 --- a/librato-iOS/Metrics/LibratoGaugeMetric.m +++ b/librato-iOS/Metrics/LibratoGaugeMetric.m @@ -71,9 +71,7 @@ + (NSDictionary *)JSONKeyPathsByPropertyKey @"sum": sumKey, @"min": minKey, @"max": maxKey, - @"squares": squaresKey, - @"type": NSNull.null, - LibratoMetricValueKey: NSNull.null + @"squares": squaresKey }; } diff --git a/librato-iOS/Metrics/LibratoMetric.m b/librato-iOS/Metrics/LibratoMetric.m index ed7b44a..e7570d0 100644 --- a/librato-iOS/Metrics/LibratoMetric.m +++ b/librato-iOS/Metrics/LibratoMetric.m @@ -61,8 +61,7 @@ + (NSDictionary *)JSONKeyPathsByPropertyKey @"name": LibratoMetricNameKey, @"value": LibratoMetricValueKey, @"measureTime": LibratoMetricMeasureTimeKey, - @"source": LibratoMetricSourceKey, - @"type": NSNull.null + @"source": LibratoMetricSourceKey }; } From 7486004ccb0a4e78e6611fd810fe14c4c9e5fd0a Mon Sep 17 00:00:00 2001 From: Sergey Kuryanov Date: Tue, 10 Jul 2018 22:16:29 +0300 Subject: [PATCH 4/4] Re-update Mantle pod --- Demo/Podfile.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Demo/Podfile.lock b/Demo/Podfile.lock index 60960d7..8eb7bb7 100644 --- a/Demo/Podfile.lock +++ b/Demo/Podfile.lock @@ -22,16 +22,16 @@ PODS: - AFNetworking/NSURLSession - librato-iOS (1.2.2): - AFNetworking (~> 2.0) - - Mantle (~> 1.3) - - Mantle (1.5.8): - - Mantle/extobjc (= 1.5.8) - - Mantle/extobjc (1.5.8) + - Mantle (~> 2.1) + - Mantle (2.1.0): + - Mantle/extobjc (= 2.1.0) + - Mantle/extobjc (2.1.0) DEPENDENCIES: - librato-iOS (from `../librato-iOS.podspec`) SPEC REPOS: - https://github.com/CocoaPods/Specs.git: + https://github.com/cocoapods/specs.git: - AFNetworking - Mantle @@ -41,9 +41,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 - librato-iOS: ac4f9b431c771cccc0719e8bdade35648fac507d - Mantle: f03b2b606c3f0cabd80214ad8a2fed6b464a7359 + librato-iOS: e66bc97e62ef9aa7ca8b94ed318595c8b86cc81d + Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b PODFILE CHECKSUM: 5817b13129eeec85d2fa75a097e506a23de0ee12 -COCOAPODS: 1.5.0 +COCOAPODS: 1.5.3