nerdycat / Cupcake

An easy way to create and layout UI components for iOS (Swift version).
MIT License
288 stars 38 forks source link

UITextView causes NSZomebie when deallocating. #14

Open nothing2lose-zz opened 5 years ago

nothing2lose-zz commented 5 years ago

co-worker found this issue.

I do not know what is make this problem exactly.

This issue does not appear if remove below code and KVO observes. UITextView.cpk_swizzle(method1: "dealloc", method2: #selector(UITextView.cpk_deinit))

image

I found some answers. but I can not found the reason.

Someone did test method swizzle already(https://github.com/inamiy/Swizzle/blob/master/SwizzleTests/_TestObject.swift).

It can be a reason.

Deinitializers are called automatically, just before instance deallocation takes place. You are not allowed to call a deinitializer yourself. Superclass deinitializers are inherited by their subclasses, and the superclass deinitializer is called automatically at the end of a subclass deinitializer implementation. Superclass deinitializers are always called, even if a subclass does not provide its own deinitializer.

daogeng commented 3 months ago

Do you have a solution?