Closed sarperdag closed 7 years ago
Can you try putting a breakpoint on the line with assertion to see if it's executed?
Tried that but the breakpoint gets hit at the end of the function. Can't even debug it line by line and see what's going on... Don't have much experience with using Swift code in objective-c projects, maybe Xcode is showing smt non-sense?
I think this is caused by #if DEBUG
being false and skipping the whole implementation. Can you see if adding this in your Podfile
helps?
# Enable DEBUG flag in Swift for DeallocationChecker
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'DeallocationChecker'
target.build_configurations.each do |config|
if config.name == 'Debug'
config.build_settings['OTHER_SWIFT_FLAGS'] = '-DDEBUG'
end
end
end
end
end
Still not working. This time it's another error:
Pods/DeallocationChecker/Sources/DeallocationChecker.swift:45:17: Method 'objc_dch_checkDeallocation(delay:)' with Objective-C selector 'dch_checkDeallocationAfterDelay:' conflicts with method 'dch_checkDeallocation(afterDelay:)' with the same Objective-C selector
@sarperdag Thanks for reporting!
I just pushed DeallocationChecker 2.0.1 which should fix this issue. No need for that post_install
phase I mentioned before too.
OK updated to 2.0.1 but here's a new error :)
Implicit declaration of function 'dch_checkDeallocation' is invalid in C99
I'm importing the library using:
import "DeallocationChecker-Swift.h"
Can you try importing using?
@import DeallocationChecker;
Already tried that, not working :)
-- Sarp Erdag
On 6 Nov 2017 21:38 +0300, Arek Holko notifications@github.com, wrote:
Can you try importing using? @import DeallocationChecker; — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I think I know what's wrong. It's a method on UIViewController
, so from Objective-C you have to call it this way:
[self dch_checkDeallocation];
Full example:
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[self dch_checkDeallocation];
}
yup, that's the reason. Seems to be working fine now. Thanks for the support!
Great to finally get this working under Obj-C! 😃
Trying to use this in an objC project, but it never fires an error even if I'm 100% sure the VC is not being deallocated...