From d6e32857f6804f23814b853dce28c92f5f84e34b Mon Sep 17 00:00:00 2001 From: Prateek Srivastava Date: Mon, 10 Oct 2016 15:27:04 -0700 Subject: [PATCH] Initialize storage before generating anonymous ID. Since 3.5.0, a regression was introduced as part of the crypto changes that would cause a new anonymous ID to be generated for every launch of the app. This change fixes that regression. --- Analytics/Classes/SEGAnalytics.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Analytics/Classes/SEGAnalytics.m b/Analytics/Classes/SEGAnalytics.m index debfea23c..4632de026 100644 --- a/Analytics/Classes/SEGAnalytics.m +++ b/Analytics/Classes/SEGAnalytics.m @@ -111,14 +111,13 @@ - (instancetype)initWithConfiguration:(SEGAnalyticsConfiguration *)configuration self.factories = [configuration.factories copy]; self.integrations = [NSMutableDictionary dictionaryWithCapacity:self.factories.count]; self.registeredIntegrations = [NSMutableDictionary dictionaryWithCapacity:self.factories.count]; - self.configuration = configuration; - self.cachedAnonymousId = [self loadOrGenerateAnonymousID:NO]; - self.httpClient = [[SEGHTTPClient alloc] initWithRequestFactory:configuration.requestFactory]; #if TARGET_OS_TV self.storage = [[SEGUserDefaultsStorage alloc] initWithDefaults:[NSUserDefaults standardUserDefaults] namespacePrefix:nil crypto:configuration.crypto]; #else self.storage = [[SEGFileStorage alloc] initWithFolder:[SEGFileStorage applicationSupportDirectoryURL] crypto:configuration.crypto]; #endif + self.cachedAnonymousId = [self loadOrGenerateAnonymousID:NO]; + self.httpClient = [[SEGHTTPClient alloc] initWithRequestFactory:configuration.requestFactory]; // Update settings on each integration immediately [self refreshSettings];