Fix podspec
Learn about leaking view controllers without opening Instruments.
First, enable the library by calling (for example from your application delegate):
#if DEBUG DeallocationChecker.shared.setup(with: .alert) // There are other options than .alert too! #endif
Then, in your view controllers from within viewDidDisappear(_:) override, call:
viewDidDisappear(_:) override
override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) DeallocationChecker.shared.checkDeallocation(of: self) }
If a view controller isn’t deallocated after disappearing for good, you’ll see a helpful alert:
At this point we can simply open the Memory Graph Debugger to investigate the reason of a cycle.
Add the line pod "DeallocationChecker" to your Podfile
pod "DeallocationChecker"
Podfile
Add the line github "fastred/DeallocationChecker" to your Cartfile
github "fastred/DeallocationChecker"
Cartfile
Project created by Arek Holko (@arekholko on Twitter).
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
DeallocationChecker
Learn about leaking view controllers without opening Instruments.
Usage
First, enable the library by calling (for example from your application delegate):
Then, in your view controllers from within
viewDidDisappear(_:) override
, call:If a view controller isn’t deallocated after disappearing for good, you’ll see a helpful alert:
At this point we can simply open the Memory Graph Debugger to investigate the reason of a cycle.
Installation
CocoaPods
Add the line
pod "DeallocationChecker"
to yourPodfile
Carthage
Add the line
github "fastred/DeallocationChecker"
to yourCartfile
Author
Project created by Arek Holko (@arekholko on Twitter).