Created
June 13, 2017 01:47
-
-
Save toshi0383/8c05f6ef5f5cc57d5d0216ec018b85bf to your computer and use it in GitHub Desktop.
なんぞこれ #CodePiece
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var player: AVPlayer? | |
func testDeallocatePlayerCrashes() { | |
player = MyPlayer() | |
// NSUnknownKeyException "...was sent to an object that is not KVC-compliant for the "bbbbbbb" property" | |
// player?.addObserver(self, forKeyPath: "bbbbbbb.aaaaaaaaa", options: [.new], context: nil) | |
// NSInternalInconsistencyException "...was deallocated while key value observers were still registered with it." | |
// player?.addObserver(self, forKeyPath: "", options: [.new], context: nil) | |
// No crash | |
player?.addObserver(self, forKeyPath: "rate", options: [.new], context: nil) | |
player = nil // MyPlayer.deinit() is called. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment