I'm developing an app in swift language to reproduce some live streaming or video on demand and I have 3 view controllers, the first is for live streaming, the second is a collection view with video on demand tuhmbnail and selecting one of this, it opens the third view controller for play the video, but when I come back from the third view controller, If I select a new video, the debugger says "received memory warning" and the app crashes, but before, I dismiss previous view controller and set to nil value the AVPlayer object and the AVPlayerLayer and I don't understand why this happen. May depend on the buffer AVPlayerItem? is possible to set it? or when I dismiss I view controller I don't destroy his instance?
Asked
Active
Viewed 1,342 times
3
-
1Try to use Instruments and check if there is some memory leak. – Larme Feb 17 '15 at 16:46
1 Answers
-1
I'd need more information to be sure, but you likely have a retain cycle where you have a strong reference to self inside of a block.
Apple explicitly states that you'll need to use weak self to avoid a retain cycle with addPeriodicTimeObserver.
Hopefully that helps. If not, could you edit and add code?

bourne_js
- 11
- 2
-
Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. – pableiros Oct 12 '16 at 02:47