From 5edda1a36a2db631817341ba51f65d01c754a20a Mon Sep 17 00:00:00 2001 From: Daniel Jih Date: Mon, 13 Mar 2017 11:57:27 -0700 Subject: [PATCH 1/5] catch and fix missing new line at eof --- Amplitude.xcodeproj/project.pbxproj | 12 +++++++++++- .../xcshareddata/xcschemes/Amplitude.xcscheme | 2 +- .../xcschemes/AmplitudeFramework.xcscheme | 2 +- .../xcshareddata/xcschemes/AmplitudeTests.xcscheme | 2 +- Amplitude/AMPURLConnection.h | 2 +- Amplitude/AMPURLConnection.m | 3 ++- Amplitude/Amplitude+SSLPinning.h | 2 +- .../SSLCertificatePinning/ISPCertificatePinning.h | 2 +- .../SSLCertificatePinning/ISPCertificatePinning.m | 2 +- .../ISPPinnedNSURLConnectionDelegate.h | 2 +- .../ISPPinnedNSURLConnectionDelegate.m | 2 +- .../ISPPinnedNSURLSessionDelegate.h | 2 +- .../ISPPinnedNSURLSessionDelegate.m | 2 +- 13 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Amplitude.xcodeproj/project.pbxproj b/Amplitude.xcodeproj/project.pbxproj index 8362b1a7..f543586d 100644 --- a/Amplitude.xcodeproj/project.pbxproj +++ b/Amplitude.xcodeproj/project.pbxproj @@ -457,7 +457,7 @@ E98C051B1A48E7FE00800C63 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0820; ORGANIZATIONNAME = Amplitude; TargetAttributes = { 343AB4161CC99F4F00962943 = { @@ -830,8 +830,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; @@ -840,6 +842,7 @@ FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -847,6 +850,7 @@ ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; @@ -875,8 +879,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; @@ -884,7 +890,9 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; @@ -904,6 +912,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_OBJC_ARC = NO; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -916,6 +925,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_OBJC_ARC = NO; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; diff --git a/Amplitude.xcodeproj/xcshareddata/xcschemes/Amplitude.xcscheme b/Amplitude.xcodeproj/xcshareddata/xcschemes/Amplitude.xcscheme index 36791468..18f3245c 100644 --- a/Amplitude.xcodeproj/xcshareddata/xcschemes/Amplitude.xcscheme +++ b/Amplitude.xcodeproj/xcshareddata/xcschemes/Amplitude.xcscheme @@ -1,6 +1,6 @@ Date: Mon, 13 Mar 2017 13:06:39 -0700 Subject: [PATCH 2/5] fix build warnings caused by certificate files --- Amplitude-iOS.podspec | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Amplitude-iOS.podspec b/Amplitude-iOS.podspec index ebd031ad..6ae060c2 100644 --- a/Amplitude-iOS.podspec +++ b/Amplitude-iOS.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/amplitude/Amplitude-iOS.git", :tag => "v3.14.0" } s.ios.deployment_target = '6.0' s.tvos.deployment_target = '9.0' - s.source_files = 'Amplitude/*', 'Amplitude/SSLCertificatePinning/*' + s.source_files = 'Amplitude/*.{h,m}', 'Amplitude/SSLCertificatePinning/*.{h,m}' s.resources = 'Amplitude/*.der' s.requires_arc = true s.library = 'sqlite3.0' diff --git a/CHANGELOG.md b/CHANGELOG.md index 399c83af..4ef1c801 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Unreleased +* Fix build warnings caused by certificate files in the Podfile. Thanks to @benasher44 for the PR. +* Fix warnings for missing new line at end of files. Thanks to @teanet for reporting. + ### 3.14.0 (February 2, 2017) * Add support for enabling SSL-pinning via Cocoapods. Thanks to @aaronwasserman for the PR. See [Readme](https://github.com/amplitude/amplitude-ios#ssl-pinning) for more information. From 4c36f47bec8bd856709f46c37ddeedc8b60770a5 Mon Sep 17 00:00:00 2001 From: Daniel Jih Date: Mon, 13 Mar 2017 13:38:39 -0700 Subject: [PATCH 3/5] catch exceptions when fetching device carrier --- Amplitude/AMPDeviceInfo.m | 33 +++++++++++++++++++-------------- CHANGELOG.md | 1 + 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Amplitude/AMPDeviceInfo.m b/Amplitude/AMPDeviceInfo.m index 0d05fe4a..d5e15cb0 100644 --- a/Amplitude/AMPDeviceInfo.m +++ b/Amplitude/AMPDeviceInfo.m @@ -78,23 +78,28 @@ -(NSString*) model { -(NSString*) carrier { if (!_carrier) { - Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo"); - SEL subscriberCellularProvider = NSSelectorFromString(@"subscriberCellularProvider"); - SEL carrierName = NSSelectorFromString(@"carrierName"); - if (CTTelephonyNetworkInfo && subscriberCellularProvider && carrierName) { - networkInfo = SAFE_ARC_RETAIN([[NSClassFromString(@"CTTelephonyNetworkInfo") alloc] init]); - id carrier = nil; - id (*imp1)(id, SEL) = (id (*)(id, SEL))[networkInfo methodForSelector:subscriberCellularProvider]; - if (imp1) { - carrier = imp1(networkInfo, subscriberCellularProvider); + @try { + Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo"); + SEL subscriberCellularProvider = NSSelectorFromString(@"subscriberCellularProvider"); + SEL carrierName = NSSelectorFromString(@"carrierName"); + if (CTTelephonyNetworkInfo && subscriberCellularProvider && carrierName) { + networkInfo = SAFE_ARC_RETAIN([[NSClassFromString(@"CTTelephonyNetworkInfo") alloc] init]); + id carrier = nil; + id (*imp1)(id, SEL) = (id (*)(id, SEL))[networkInfo methodForSelector:subscriberCellularProvider]; + if (imp1) { + carrier = imp1(networkInfo, subscriberCellularProvider); + } + NSString* (*imp2)(id, SEL) = (NSString* (*)(id, SEL))[carrier methodForSelector:carrierName]; + if (imp2) { + _carrier = SAFE_ARC_RETAIN(imp2(carrier, carrierName)); + } } - NSString* (*imp2)(id, SEL) = (NSString* (*)(id, SEL))[carrier methodForSelector:carrierName]; - if (imp2) { - _carrier = SAFE_ARC_RETAIN(imp2(carrier, carrierName)); + else { + _carrier = SAFE_ARC_RETAIN(@"Unknown"); } } - else { - return @"Unknown"; + @catch (NSException *exception) { + _carrier = SAFE_ARC_RETAIN(@"Unknown"); } } return _carrier; diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ef1c801..bf603340 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Unreleased +* Catch exceptions when looking up device carrier. * Fix build warnings caused by certificate files in the Podfile. Thanks to @benasher44 for the PR. * Fix warnings for missing new line at end of files. Thanks to @teanet for reporting. From 9948edf67d9881a46090c3bf25209a26541f1be1 Mon Sep 17 00:00:00 2001 From: Daniel Jih Date: Mon, 13 Mar 2017 14:13:52 -0700 Subject: [PATCH 4/5] fix linker warnings for amplitude framework extension --- Amplitude.xcodeproj/project.pbxproj | 2 ++ CHANGELOG.md | 1 + 2 files changed, 3 insertions(+) diff --git a/Amplitude.xcodeproj/project.pbxproj b/Amplitude.xcodeproj/project.pbxproj index f543586d..9889a6c3 100644 --- a/Amplitude.xcodeproj/project.pbxproj +++ b/Amplitude.xcodeproj/project.pbxproj @@ -721,6 +721,7 @@ 343AB41C1CC99F4F00962943 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -749,6 +750,7 @@ 343AB41D1CC99F4F00962943 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ef1c801..fa1a0900 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Fix build warnings caused by certificate files in the Podfile. Thanks to @benasher44 for the PR. * Fix warnings for missing new line at end of files. Thanks to @teanet for reporting. +* Fix linker warnings when using Amplitude framework in an extension target. Thanks to @r-peck for the PR. ### 3.14.0 (February 2, 2017) From 15b103402407a883e5a26bdcf6a737f5ea65f96f Mon Sep 17 00:00:00 2001 From: Daniel Jih Date: Tue, 14 Mar 2017 21:17:04 -0700 Subject: [PATCH 5/5] v3.14.1 --- Amplitude-iOS.podspec | 4 ++-- Amplitude/AMPConstants.m | 2 +- CHANGELOG.md | 2 ++ README.md | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Amplitude-iOS.podspec b/Amplitude-iOS.podspec index 6ae060c2..f3652c53 100644 --- a/Amplitude-iOS.podspec +++ b/Amplitude-iOS.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "Amplitude-iOS" - s.version = "3.14.0" + s.version = "3.14.1" s.summary = "Amplitude mobile analytics iOS SDK." s.homepage = "https://amplitude.com" s.license = { :type => "MIT" } s.author = { "Amplitude" => "dev@amplitude.com" } - s.source = { :git => "https://github.com/amplitude/Amplitude-iOS.git", :tag => "v3.14.0" } + s.source = { :git => "https://github.com/amplitude/Amplitude-iOS.git", :tag => "v3.14.1" } s.ios.deployment_target = '6.0' s.tvos.deployment_target = '9.0' s.source_files = 'Amplitude/*.{h,m}', 'Amplitude/SSLCertificatePinning/*.{h,m}' diff --git a/Amplitude/AMPConstants.m b/Amplitude/AMPConstants.m index e5999492..f032a362 100644 --- a/Amplitude/AMPConstants.m +++ b/Amplitude/AMPConstants.m @@ -4,7 +4,7 @@ #import "AMPConstants.h" NSString *const kAMPLibrary = @"amplitude-ios"; -NSString *const kAMPVersion = @"3.14.0"; +NSString *const kAMPVersion = @"3.14.1"; NSString *const kAMPEventLogDomain = @"api.amplitude.com"; NSString *const kAMPEventLogUrl = @"https://api.amplitude.com/"; NSString *const kAMPDefaultInstance = @"$default_instance"; diff --git a/CHANGELOG.md b/CHANGELOG.md index d27a80e6..57461da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Unreleased +### 3.14.1 (March, 14, 2017) + * Catch exceptions when looking up device carrier. * Fix build warnings caused by certificate files in the Podfile. Thanks to @benasher44 for the PR. * Fix warnings for missing new line at end of files. Thanks to @teanet for reporting. diff --git a/README.md b/README.md index 105fc50f..d3965463 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ A [demo application](https://github.com/amplitude/iOS-Demo) is available to show A [demo application](https://github.com/amplitude/iOS-Extension-Demo) is available to show a simple integration in iOS extensions. -See our [SDK documentation](https://rawgit.com/amplitude/Amplitude-iOS/v3.14.0/documentation/html/index.html) for a description of all available SDK methods and classes. +See our [SDK documentation](https://rawgit.com/amplitude/Amplitude-iOS/v3.14.1/documentation/html/index.html) for a description of all available SDK methods and classes. Our iOS SDK also supports tvOS. See [below](https://github.com/amplitude/Amplitude-iOS#tvos) for more information. @@ -19,7 +19,7 @@ Our iOS SDK also supports tvOS. See [below](https://github.com/amplitude/Amplitu 2. [Download the source code](https://github.com/amplitude/Amplitude-iOS/archive/master.zip) and extract the zip file. - Alternatively, you can pull directly from GitHub. If you use CocoaPods, add the following line to your Podfile: `pod 'Amplitude-iOS', '~> 3.14.0'`. If you are using CocoaPods, you may skip steps 3 and 4. + Alternatively, you can pull directly from GitHub. If you use CocoaPods, add the following line to your Podfile: `pod 'Amplitude-iOS', '~> 3.14.1'`. If you are using CocoaPods, you may skip steps 3 and 4. You also have the option to install using Carthage. If you are using Carthage, add the following line to your Cartfile: `github "amplitude/Amplitude-iOS"`. Just add `#import ` to import all of the Amplitude header files.