Property Has a Previous Declaration

与世无争的帅哥 提交于 2019-12-09 17:10:56

问题


I tried adding XMPP framework into my ios project and I couldn't get it working. Turns out I added it incorrectly, So I tried removing it and now without XMPP I am getting these errors: Thanks in Advance!


回答1:


This could also happen because of CocoaPods. I had this issue with version cocoapods-0.39.0, downgrading to cocoapods-0.38.2 fixed it for now.




回答2:


You have two copies of AFNetworking in your project. Delete one of them.

...or better yet, use CocoaPods to integrate AFNetworking and your XMPP framework into your project.




回答3:


It may be due to a number of the same property added




回答4:


I got this error after I refactored class from Obj-c to Swift and although classes names was different but methods names stay the same, so that was causing "Property Has a Previous Declaration" error. But it was only when I try to run app on different target.

So I just remove refactored class from project and clean the project, that solve the problem for me.




回答5:


One of the reason for this is you are having duplicate .h or .m files.
A temporary workaround is to just select your project in Xcode, right-click and hit "Show in Finder".
Search for the file that is giving you error.
You will find two files of that name.
Simply delete one and you are good to go.




回答6:


I had the same problem when I copied and paste whole XCode project to another location and opened it there. Probably has something with project settings and default paths for classes. Try making a new project and copying and pasting each class individually into the new project, created properly.




回答7:


the error is your interface Duplicate interface definition for class. this is work for me duplicate interface declaration for class. somehow you have managed to import the .h file twice. Check to make sure you always use #import and not #include.




回答8:


I don't think this will answer your specific problem, but for other people who got here via Google, in my case the problem was caused by a name collision of embedded class in a custom framework. Example of code that will result in such error:

public class Car: NSObject {
    public class Wheel: NSObject {
    }
}

public class Truck: NSObject {
    public class Wheel: NSObject {
        // "Wheel" class is duplicated and even though it's embedded in another class,
        // it will still result in a collision in a ".h" file
    }
}

I'm not actually sure if inheriting from NSObject changes anything here.



来源:https://stackoverflow.com/questions/26386372/property-has-a-previous-declaration

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