meismyles / SwiftWebVC

A drop-in inline browser for your Swift iOS app.
MIT License
329 stars 117 forks source link

Dismissing SwiftModalWebVC does not stop webview #9

Closed bchrobot closed 7 years ago

bchrobot commented 7 years ago

For example, if you are playing audio in a modal web VC and dismiss it the audio continues playing.

I believe this is due to the doneButtonTapped method being handled by the child webViewController: SwiftWebVC

meismyles commented 7 years ago

Is this definitely not due to the audio playback becoming system wide? For example, if you play something in the default browser and then background it, it will continue to play and will show the media playback source in the control centre if you slide that up (along with controls to pause it etc.)

bchrobot commented 7 years ago

Right, but backgrounding is different than what should be a deinit when the modal is dismissed. I added logs in viewDidLoad() and deinit for both SwiftWebVC and SwiftModalWebVC to confirm.

When SwiftWebVC is pushed and then popped from the navigation stack it behaves as expected.

When SwiftModalWebVC is presented and then dismissed both the modal and its SwiftWebVC are initialized, but only the SwiftModalWebVC is deinitialized so there is a retain cycle somewhere in there.

meismyles commented 7 years ago

Looking at it now but at first glance can't seem to find a pesky reference anywhere that would cause it to be retained. Going to have dig deeper 😭

bchrobot commented 7 years ago

I will also do some digging over the holidays when I have a bit more time

meismyles commented 7 years ago

Fixed in release 0.2.1 which I am about to push now.

bchrobot commented 7 years ago

🎉