How to properly release Objective-C wrapper class?


Using XCode Instruments to detect leaks I see multiple leaked TOCImport objects (48 bytes).
I know that ARC takes care of releasing objects on both the native iOS (Objective C) side and the Delphi side, but the OCwrapper classes are in between.

For example I made this function to simplify creation of UIImageView:

function iosUIImageView(aUIImage: UIImage): UIImageView;
result := TUIImageView.Wrap(TUIImageView.Wrap(TUIImageView.OCClass.alloc).initWithImage(aUIImage));

When closing the app, it leaks a TOCImport object.

What is the best way to avoid this leak?

Comments are closed.