refresher
refresher copied to clipboard
Swift KVO crash after deinit
hello, in your demo project, the view controller would't be released(memery leak).After I added unowned self
, the view controller has deinit, but demo will crash. It will append <= iOS11, it's look like system bug.
Is this when you go back while pull to refresh is loading? I think weak self should help in this situation.
I'm afraid not.I tried, but it still crash.You can try this on any simulator that <= iOS11.
The reason is the ScrollView own a NSKeyValueObservation instance that observer the same ScrollView.But on iOS11, That all work.
Same here
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7ff436072600 of class UITableView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x608000427ce0> (
<NSKeyValueObservance 0x6080004417a0: Observer: 0x610000478780, Key path: contentOffset, Options: <New: NO, Old: NO, Prior: NO> Context: 0x0, Property: 0x61000044d500>
)'
Are you able to reproduce this consistently?