本文介绍: IOS16调试的时候报错

IOS16调试的时候报错
Application circumvented objective-c runtime dealloc initiation for <%s> object

原因

IOS16 苹果不允许重写系统控件分类(Categroy)中重写 + (void)initialize方法

苹果的说法

initialize is invoked only once per class. If you want to perform independent initialization for the class and for categories of the class, you should implement load methods.

作者在UIView+XXX中复写了+ (void)initialize方法,在方法添加swizzle方法替换,导致的该问题解决方法是将swizzle方法替换写到+ (void)load中,大家可根据自身情况更改,避免复写系统控件+ (void)initialize方法

资料

https://developer.apple.com/forums/thread/711358

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注