Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain cycle between SEGAnalytics and SEGIntegrationsManager #1054

Open
gpambrozio opened this issue May 4, 2023 · 0 comments
Open

Retain cycle between SEGAnalytics and SEGIntegrationsManager #1054

gpambrozio opened this issue May 4, 2023 · 0 comments

Comments

@gpambrozio
Copy link

gpambrozio commented May 4, 2023

When SEGAnalytics is initialized, it creates and strongly retains a SEGIntegrationsManager, passing self to SEGIntegrationsManager's initializer, which then retains it strongly, thus creating a retain cycle.

This becomes an issue for our project as we sometimes switch environment and they have different keys so we have to re-create SEGAnalytics. When we do this the old one still sticks around and we then start to send multiple events for application events as the old SEGAnalytics is still getting notifications from the notification center.

Relevant declarations:

https://github.com/segmentio/analytics-ios/blob/master/Segment/Classes/SEGAnalytics.m#L28
https://github.com/segmentio/analytics-ios/blob/master/Segment/Internal/SEGIntegrationsManager.m#L67

Oh, the irony: https://github.com/segmentio/analytics-ios/blob/master/Segment/Classes/SEGAnalytics.m#L53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant