ARC: “Pointer to non-const type 'id' with no explicit ownership”

血红的双手。 提交于 2019-12-30 05:44:27

问题


i am upgrading an iOS 4 project to use it with ARC with the sdk5. So i want to use the automatic refactor method for converting the code to use ARC. Unfortunately it does´t work. I get a lots of errors..

for(id* child in childObjectArray){
    [child removeParentGroupReferences];
}

That gives me the following error output:

Pointer to non-const type 'id' with no explicit ownership

Any help about that? What do i have to change? Thanks for any help..


回答1:


Change id* to id. id is already defined as an object pointer.




回答2:


id is a type, not an object. That means that id shouldn't be a pointer. Remove the * to fix it.

for(id child in childObjectArray){
    [child removeParentGroupReferences];
}


来源:https://stackoverflow.com/questions/9263713/arc-pointer-to-non-const-type-id-with-no-explicit-ownership

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