After Auto-ARC Conversion: Assigning retained object to unsafe property; object will be released after assignment

流过昼夜 提交于 2019-12-02 18:54:52

I've run into the same warning and opened an Technical Support Incident. The engineer verified that the default was changed from "assign" to "strong" for reasons of consistency within ARC.

He said both the warning and the documentation are wrong and will be fixed. Until that is done, I would avoid the implicit default altogether!

Explicitly adding "strong" (as BJ Homer suggested) is a safe way to silence the warning and be compatible. But don't assume properties to be unretained by default. Always put "weak" or "assign" there, too.

Edit: The clang documentation now officially documents this change. The warning has been fixed.

Edit 2: Xcode 4.4 apparently includes the fix.

It looks wrong that it converted nonatomic, retain to nonatomic. I've always seen it convert to nonatomic, strong. If you can produce a simple project that converts in the way you saw it then I suggest filing a radar with it.

I assume by the way that you're using the latest Xcode.

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