Skip to content

Commit d560945

Browse files
author
Fathy Boundjadj
authored
Fix GCD mutual dependency (#785)
1 parent cf99cb6 commit d560945

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

Analytics/Classes/Internal/SEGSegmentIntegration.m

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,26 +106,18 @@ - (id)initWithAnalytics:(SEGAnalytics *)analytics httpClient:(SEGHTTPClient *)ht
106106
[self trackAttributionData:self.configuration.trackAttributionData];
107107
}];
108108

109-
if ([NSThread isMainThread]) {
110-
[self setupFlushTimer];
111-
} else {
112-
dispatch_sync(dispatch_get_main_queue(), ^{
113-
[self setupFlushTimer];
114-
});
115-
}
109+
self.flushTimer = [NSTimer timerWithTimeInterval:self.configuration.flushInterval
110+
target:self
111+
selector:@selector(flush)
112+
userInfo:nil
113+
repeats:YES];
114+
115+
[NSRunLoop.mainRunLoop addTimer:self.flushTimer
116+
forMode:NSDefaultRunLoopMode];
116117
}
117118
return self;
118119
}
119120

120-
- (void)setupFlushTimer
121-
{
122-
self.flushTimer = [NSTimer scheduledTimerWithTimeInterval:self.configuration.flushInterval
123-
target:self
124-
selector:@selector(flush)
125-
userInfo:nil
126-
repeats:YES];
127-
}
128-
129121
/*
130122
* There is an iOS bug that causes instances of the CTTelephonyNetworkInfo class to
131123
* sometimes get notifications after they have been deallocated.

0 commit comments

Comments
 (0)