解决方法
使用下面的方法,其功能与dealloc相同.
- deinit {
- // Release all recoureces
- // perform the deinitialization
- }
A deinitializer is called immediately before a class instance is deallocated. You write deinitializers with the deinit keyword,similar to how intializers are written with the init keyword. Deinitializers are only available on class types.