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

Mixpanel instance still in memory and sending requests when app becomes active #285

Closed
NickyWeber opened this issue Jul 10, 2015 · 9 comments

Comments

@NickyWeber
Copy link

iOS Version 8.3
Mixpanel verison 2.8.1

It seems as if you create an instance of Mixpanel with the initWithToken... method it will remain in memory still listening to events like UIApplicationDidBecomeActiveNotification.

A breakpoint in Mixpanel.m -applicationDidBecomeActive should suffice to see the behaviour.

Some steps to reproduce:

  • Create an instance of Mixpanel with initWithToken method
  • Store that instance in a property with strong attribute
  • set that property to nil
  • Send app to background
  • Add breakpoint in Mixpanel.m -applicationDidBecomeActive
  • Open app again

When setting

#define DISABLE_MIXPANEL_AB_DESIGNER

This bug does not occur.

@samgreen
Copy link
Contributor

Thanks so much for this detailed report. Very clear instructions. I will investigate and get back to you today.

@samgreen
Copy link
Contributor

@NickyWeber I was able to reproduce this issue. Looking at a fix now.

@NickyWeber
Copy link
Author

@samgreen Wow, that was fast, thank you very much.

@samgreen
Copy link
Contributor

@NickyWeber So it occurs to me that this issue will not be easily resolved with the existing API. Since we create an internal instance for use as a singleton. We have an internal static variable that will stick around for the life of the application to allow easy access to Mixpanel once initialized.

Can you tell me a bit more on a higher level, about what you're trying to accomplish and how this instance sticking around in memory is preventing that?

@NickyWeber
Copy link
Author

We have implemented an opt out switch for the user. As soon as the user opts out any tracking has to be disabled. A nice property that will disable any kind of requests or a dedicated method to tell the tracker that a user opted out would do.

@samgreen
Copy link
Contributor

Do the work arounds mentioned by #277 help at all?

@NickyWeber
Copy link
Author

It doesn't. Disabling tracking in general has already been achieved except this one case. Can you provide a way to get rid off the singleton?

@samgreen
Copy link
Contributor

@NickyWeber How about we add a global method, something like [Mixpanel setDisabled:YES], then if you attempt to log an event, we'll just warn to the console that Mixpanel has been explicitly disabled.

@NickyWeber
Copy link
Author

@samgreen That is a good solution. However I'd rather not have the tracker clutter the console for every event in general. Maybe just for a logging level of verbose?

gmorning pushed a commit to gmorning/mixpanel-iphone that referenced this issue Apr 28, 2020
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

2 participants