Rich-text Reply

Optimizely retains part of our view hierarchy and won't let go

Jadeburton 06-28-16

Optimizely retains part of our view hierarchy and won't let go

Our app destroys most of its UI view hierarchy when the user "logs out" and returns to a kind of welcome/login screen.  

 

We have asserts in the code to ensure that no instances of certain views are alive after the user has logged out.  (If they were alive they might do things that we don't want while the user is logged out.)

 

Recently we noticed that these asserts started firing after logging out.  We discovered that removing the Optimizely SDK fixed the issue.  

 

It does not seem to happen in our older versions of the app that supports iOS 7 and iOS 8, though that may be a coincidence.

 

The issue only happens if the app is put in the background and then brought back to the foreground while the user is logged in.  If you don't put the app in the background you can use it and log out without any asserts firing.  Perhaps UIApplicationDidEnterBackground or UIApplicationWillEnterForeground causes Optimizely to retain parts of our view hierarchy, keeping it alive after the user logs out.

 

Is there a way to A) cleanly shut down Optimizely and guarantee nothing is retained after that point, or B) fix what would seem to be a bug in the SDK?

 

Zsolt 06-29-16
 

Re: Optimizely retains part of our view hierarchy and won't let go

You might want to give "Manual activation" a try: http://developers.optimizely.com/ios/reference/index.html#manual-activation
This way the experiment would run only if you make the API call.
Level 5
tedroddy 06-30-16
 

Re: Optimizely retains part of our view hierarchy and won't let go

[ Edited ]

Jadeburton,

Thanks for bringing this potential bug to our attention. Our Engineering team is looking into it to see if there is a fix.

Would you be able to try reproducing this with [Optimizely disableSwizzle]; before startOptimizely?

Best,
Ted
Optimizely
mtaube 08-16-16
 

Re: Optimizely retains part of our view hierarchy and won't let go

Hey @tedroddy was this issue ever addressed? We are having the same problem with all views being retained – but doesn't happen when Optimizely SDK is removed.

Level 1
tedroddy 09-06-16
 

Re: Optimizely retains part of our view hierarchy and won't let go

@mtaube Sorry for the delay in response here  — I did not receive a notification for your question and just happened to stumble upon it when Googling.

 

This view hierachy retaining issue was address in SDK 1.6.0. Are you still having this issue? If so, which version of the SDK are you using?

Best,
Ted
Optimizely