“Missing [super dealloc]” warning in an ARC project

戏子无情 提交于 2019-12-05 09:18:09

Put the following lines into your dealloc method to make sure it is compiled with ARC enabled:

#if ! __has_feature(objc_arc)
#error "ARC is off"
#endif

If you get the compiler error when building, you're sure that ARC is off and have to search for the reason. It's probably in per-file build settings in your target.

I did resolved this warning by following steps:

  1. Click target(<yourapp>.xcodeproj) in which the file(<classname>.m) class shows above warning
  2. Select TARGET >> Build Phases >> Compile sources
  3. Search file
  4. Add Compiler Flags -fobjc-arc

This is looks like below

"Have you tried turning it off and on again?"

This is a silly answer, but cleaning the target and restarting Xcode has solved this very irritating behavior for me

  • Menu > Product > Clean
  • Menu > Product > (press the alt key) Clean Project Folder
  • restart Xcode

After that, I got more ARC related warnings, so clearly, Xcode wasn't finished converting to ARC. Now the warning is gone and everything works just fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!