Skip to content
This repository was archived by the owner on Nov 24, 2021. It is now read-only.

Commit a2633ba

Browse files
authored
Proposed fix for NSKVODeallocate (#96)
1 parent b4e3047 commit a2633ba

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Source/VideoView.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ class VideoView: UIView {
6262
fatalError("init(coder:) has not been implemented")
6363
}
6464

65+
// Proposed workaround to fix some issues with observers called after being deallocated.
66+
// Error description:
67+
// Fatal Exception: NSInternalInconsistencyException
68+
// An instance 0x15ed87220 of class AVPlayerItem was deallocated while key value observers were still registered with it.
69+
deinit {
70+
self.removeBeforePlayingObservers()
71+
self.removeWhilePlayingObservers()
72+
}
73+
6574
override func layoutSubviews() {
6675
super.layoutSubviews()
6776

0 commit comments

Comments
 (0)