From fe92a23e192733b763a89e275d4ed996dd65b1b1 Mon Sep 17 00:00:00 2001 From: sheng <277715243@qq.com> Date: Mon, 31 Aug 2020 14:06:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dtracker=E7=9A=84?= =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6=E5=BC=95=E7=94=A8=E5=88=B0autotrack?= =?UTF-8?q?er=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=B7=B2=E7=BB=8F=E5=8E=BB=E6=8E=89=E7=9A=84?= =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GrowingTracker/Helpers/GrowingHelpers.h | 3 --- GrowingTracker/Menu/GrowingAlert.m | 13 +++++++++---- GrowingTracker/Public/GrowingTracker.m | 13 +++++++------ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/GrowingTracker/Helpers/GrowingHelpers.h b/GrowingTracker/Helpers/GrowingHelpers.h index 50ef3a50d..8ffdef83f 100644 --- a/GrowingTracker/Helpers/GrowingHelpers.h +++ b/GrowingTracker/Helpers/GrowingHelpers.h @@ -20,16 +20,13 @@ #import "NSData+GrowingHelper.h" #import "NSObject+GrowingIvarHelper.h" -#import "NSNumber+GrowingHelper.h" #import "NSDictionary+GrowingHelper.h" #import "UIControl+GrowingHelper.h" #import "UIImage+GrowingHelper.h" #import "NSString+GrowingHelper.h" #import "UIView+GrowingHelper.h" -#import "NSObject+GrowingHelper.h" #import "NSArray+GrowingHelper.h" #import "UIWindow+GrowingHelper.h" #import "UIApplication+GrowingHelper.h" -#import "UITextField+GrowingHelper.h" #import "NSURL+GrowingHelper.h" #import "GrowingDispatchManager.h" diff --git a/GrowingTracker/Menu/GrowingAlert.m b/GrowingTracker/Menu/GrowingAlert.m index 0ae842d43..ab5ee06ab 100644 --- a/GrowingTracker/Menu/GrowingAlert.m +++ b/GrowingTracker/Menu/GrowingAlert.m @@ -17,7 +17,7 @@ // limitations under the License. #import "GrowingAlert.h" - +#import "GrowingCocoaLumberjack.h" typedef NS_ENUM(NSUInteger, GrowingAlertError) { alertControllerNil = 0, popoverNotSet = 1, @@ -195,9 +195,14 @@ - (void)addDestructiveWithTitle:(NSString *)title - (void)showAlertAnimated:(BOOL)animated { UIViewController *sourceViewController = [[UIApplication sharedApplication] growing_topMostViewController]; - [sourceViewController presentViewController:self.alertController - animated:YES - completion:nil]; + if (sourceViewController) { + [sourceViewController presentViewController:self.alertController + animated:YES + completion:nil]; + }else { + GIOLogError(@"Alert show Error : Window Top ViewController is not find"); + } + } @end diff --git a/GrowingTracker/Public/GrowingTracker.m b/GrowingTracker/Public/GrowingTracker.m index 1aa9c7ef0..d89195a2a 100644 --- a/GrowingTracker/Public/GrowingTracker.m +++ b/GrowingTracker/Public/GrowingTracker.m @@ -19,6 +19,7 @@ #import "GrowingTracker.h" +#import "GrowingAlert.h" #import "GrowingInstance.h" #import "GrowingCustomField.h" #import "GrowingEventManager.h" @@ -33,6 +34,7 @@ #import "GrowingBroadcaster.h" #import "GrowingWSLoggerFormat.h" + @import CoreLocation; static NSString* const kGrowingVersion = @"3.0.0"; @@ -77,12 +79,11 @@ + (void)startWithConfiguration:(GrowingConfiguration *)configuration { + (BOOL)urlSchemeCheck { if ([GrowingDeviceInfo currentDeviceInfo].urlScheme.length == 0) { - UIAlertView *view = [[UIAlertView alloc] initWithTitle:@"未检测到GrowingIO的URLScheme" - message:@"请参考帮助文档 https://help.growingio.com/SDK/iOS.html#urlscheme 进行集成" - delegate:nil - cancelButtonTitle:@"OK" - otherButtonTitles:nil]; - [view show]; + GrowingAlert *alert = [GrowingAlert createAlertWithStyle:UIAlertControllerStyleAlert + title:@"未检测到GrowingIO的URLScheme" + message:@"请参考帮助文档 https://help.growingio.com/SDK/iOS.html#urlscheme 进行集成"]; + [alert addOkWithTitle:@"OK" handler:nil]; + [alert showAlertAnimated:YES]; GIOLogError(@"未检测到GrowingIO的URLScheme !!!"); GIOLogInfo (@"请参考帮助文档 https://help.growingio.com/SDK/iOS.html#urlscheme 进行集成"); return NO;