From 3850f24691b4ba40a0407e710edf9a68e3236309 Mon Sep 17 00:00:00 2001 From: Brandon Sneed Date: Tue, 14 Feb 2023 10:59:08 -0800 Subject: [PATCH 1/2] Fix objc example to alleviate analytics leaving scope and terminating --- .../ObjCExample/ObjCExample.xcodeproj/project.pbxproj | 8 ++++---- Examples/apps/ObjCExample/ObjCExample/AppDelegate.h | 2 ++ Examples/apps/ObjCExample/ObjCExample/AppDelegate.m | 10 ++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Examples/apps/ObjCExample/ObjCExample.xcodeproj/project.pbxproj b/Examples/apps/ObjCExample/ObjCExample.xcodeproj/project.pbxproj index 0036027f..47e901c1 100644 --- a/Examples/apps/ObjCExample/ObjCExample.xcodeproj/project.pbxproj +++ b/Examples/apps/ObjCExample/ObjCExample.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 460FF309299AAEEC00635FF9 /* Segment in Frameworks */ = {isa = PBXBuildFile; productRef = 460FF308299AAEEC00635FF9 /* Segment */; }; 464247BC26C6D7A700CAD301 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 464247BB26C6D7A700CAD301 /* AppDelegate.m */; }; 464247BF26C6D7A700CAD301 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 464247BE26C6D7A700CAD301 /* SceneDelegate.m */; }; 464247C226C6D7A700CAD301 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 464247C126C6D7A700CAD301 /* ViewController.m */; }; @@ -14,7 +15,6 @@ 464247C726C6D7A800CAD301 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 464247C626C6D7A800CAD301 /* Assets.xcassets */; }; 464247CA26C6D7A800CAD301 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 464247C826C6D7A800CAD301 /* LaunchScreen.storyboard */; }; 464247CD26C6D7A800CAD301 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 464247CC26C6D7A800CAD301 /* main.m */; }; - 464247D526C6D7DC00CAD301 /* Segment in Frameworks */ = {isa = PBXBuildFile; productRef = 464247D426C6D7DC00CAD301 /* Segment */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -37,7 +37,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 464247D526C6D7DC00CAD301 /* Segment in Frameworks */, + 460FF309299AAEEC00635FF9 /* Segment in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -103,7 +103,7 @@ ); name = ObjCExample; packageProductDependencies = ( - 464247D426C6D7DC00CAD301 /* Segment */, + 460FF308299AAEEC00635FF9 /* Segment */, ); productName = ObjCExample; productReference = 464247B726C6D7A700CAD301 /* ObjCExample.app */; @@ -357,7 +357,7 @@ /* End XCConfigurationList section */ /* Begin XCSwiftPackageProductDependency section */ - 464247D426C6D7DC00CAD301 /* Segment */ = { + 460FF308299AAEEC00635FF9 /* Segment */ = { isa = XCSwiftPackageProductDependency; productName = Segment; }; diff --git a/Examples/apps/ObjCExample/ObjCExample/AppDelegate.h b/Examples/apps/ObjCExample/ObjCExample/AppDelegate.h index beae4528..1ae40cd3 100644 --- a/Examples/apps/ObjCExample/ObjCExample/AppDelegate.h +++ b/Examples/apps/ObjCExample/ObjCExample/AppDelegate.h @@ -6,9 +6,11 @@ // #import +@import Segment; @interface AppDelegate : UIResponder +@property (nonatomic, retain, nullable) SEGAnalytics *analytics; @end diff --git a/Examples/apps/ObjCExample/ObjCExample/AppDelegate.m b/Examples/apps/ObjCExample/ObjCExample/AppDelegate.m index 4188dc37..af3f6968 100644 --- a/Examples/apps/ObjCExample/ObjCExample/AppDelegate.m +++ b/Examples/apps/ObjCExample/ObjCExample/AppDelegate.m @@ -18,13 +18,15 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. - SEGConfiguration *config = [[SEGConfiguration alloc] initWithWriteKey:@"WRITE_KEY"]; + SEGConfiguration *config = [[SEGConfiguration alloc] initWithWriteKey:@"GM88xxNqA6PfthZE9ZzA2AREQBMjc6xA"]; config.trackApplicationLifecycleEvents = YES; - SEGAnalytics *analytics = [[SEGAnalytics alloc] initWithConfiguration: config]; + _analytics = [[SEGAnalytics alloc] initWithConfiguration: config]; - [analytics track:@"test"]; - [analytics track:@"testProps" properties:@{@"email": @"blah@blah.com"}]; + [self.analytics track:@"test"]; + [self.analytics track:@"testProps" properties:@{@"email": @"blah@blah.com"}]; + + [self.analytics flush]; return YES; } From e84933da620f2d4bd227ae6d3593e6c6524b9f32 Mon Sep 17 00:00:00 2001 From: Brandon Sneed Date: Tue, 14 Feb 2023 11:01:48 -0800 Subject: [PATCH 2/2] removed writekey --- Examples/apps/ObjCExample/ObjCExample/AppDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/apps/ObjCExample/ObjCExample/AppDelegate.m b/Examples/apps/ObjCExample/ObjCExample/AppDelegate.m index af3f6968..301897b6 100644 --- a/Examples/apps/ObjCExample/ObjCExample/AppDelegate.m +++ b/Examples/apps/ObjCExample/ObjCExample/AppDelegate.m @@ -18,7 +18,7 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. - SEGConfiguration *config = [[SEGConfiguration alloc] initWithWriteKey:@"GM88xxNqA6PfthZE9ZzA2AREQBMjc6xA"]; + SEGConfiguration *config = [[SEGConfiguration alloc] initWithWriteKey:@""]; config.trackApplicationLifecycleEvents = YES; _analytics = [[SEGAnalytics alloc] initWithConfiguration: config];