首页 > 代码库 > Swift教程_swift常见问题(0005)_完美解决Cannot override 'dealloc'异常

Swift教程_swift常见问题(0005)_完美解决Cannot override 'dealloc'异常

Swift教程_swift常见问题(0001)_CoreData: warning: Unable to load class named ‘xxx‘ for entity ‘xxx‘

Swift教程_swift常见问题(0002)_完美处理SourceKitService Crashed异常。6.1.1大部分已经修复

Swift教程_swift常见问题(0003)_storyboard改动不生效

Swift教程_swift常见问题(0004)_swift代码不能自己主动提示和补全

Swift教程_swift常见问题(0005)_完美解决Cannot override ‘dealloc‘异常

Swift教程_swift常见问题(0006)_完美解决swift数组索引是变量时的内存溢出

Swift教程_swift常见问题(0007)_Can‘t find model for source store


问题描写叙述:

swift已经移除了dealloc()方法,所以假设重写的话会报:

Cannot override ‘dealloc‘ which has been marked unavailable


解决方式:

swift使用析构方法进行类似dealloc的操作。析构方法和构造方法相对,分别为deinit和init。


点击进入ooppookid的博客

Swift教程_swift常见问题(0005)_完美解决Cannot override 'dealloc'异常