From 63d61315bb4be4df0c1428e5e0db8d3e941b8d86 Mon Sep 17 00:00:00 2001 From: Korin Date: Wed, 13 May 2020 10:55:20 -0700 Subject: [PATCH] change logic for naming conventions fix test --- Analytics/Classes/Internal/UIViewController+SEGScreen.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Analytics/Classes/Internal/UIViewController+SEGScreen.m b/Analytics/Classes/Internal/UIViewController+SEGScreen.m index 4b1a7847f..3fb0b0b61 100644 --- a/Analytics/Classes/Internal/UIViewController+SEGScreen.m +++ b/Analytics/Classes/Internal/UIViewController+SEGScreen.m @@ -96,9 +96,11 @@ - (void)seg_viewDidAppear:(BOOL)animated return; } - NSString *name = [top title]; + NSString *name = [[[top class] description] stringByReplacingOccurrencesOfString:@"ViewController" withString:@""]; + if (!name || name.length == 0) { - name = [[[top class] description] stringByReplacingOccurrencesOfString:@"ViewController" withString:@""]; + // if no class description found, try view controller's title. + name = [top title]; // Class name could be just "ViewController". if (name.length == 0) { SEGLog(@"Could not infer screen name.");