Property Has a Previous Declaration
Asked Answered
M

8

10

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! enter image description here

Mesencephalon answered 15/10, 2014 at 15:30 Comment(2)
Is there a way that you can either make the image bigger or copy the text out of it into your message? (Or: "What is this, a screenshot for ANTS?!")Uncompromising
Made it a little bigger sorry about that!Mesencephalon
D
16

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.

Dundee answered 14/10, 2015 at 7:16 Comment(7)
This did the trick for me as well (6 hours into banging my head on the desk). Can you explain how you figured this out so we can open an issue on Github? I haven't seen this reported yet.Casualty
same here... tried everything for a few hours... than downgraded to 0.38.2 and worked perfectlyThirza
Did you do anything special before downgrading? I seem to have the same issue as you but can't fix it since days. I downgraded to 0.38.2 as explained here but that doesn't fix it: #20488349 I also recloned the project and reinstalled XCode even.Brack
@JWKothe make sure you also clean your project and delete your derived data. I'm still investigating and will submit an issue asap.Dundee
@Dundee Yes deleting the derived data solved the problem for me finally. Took me days to figure it out.Brack
Following these steps worked for me too. Props to Antoine for this tip.Eichelberger
@Dundee Yes deleting the derived data solved the problem for me finally [2]. thanks a bunch!Camisole
Z
5

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.

Zipnick answered 16/10, 2014 at 1:28 Comment(0)
M
3

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

Mosora answered 3/6, 2016 at 6:39 Comment(0)
P
2

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.

Particulate answered 17/6, 2016 at 8:11 Comment(0)
K
1

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.

Kay answered 20/6, 2016 at 23:49 Comment(0)
D
1

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.

Dexedrine answered 27/6, 2016 at 19:15 Comment(0)
P
1

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.

Potsdam answered 7/7, 2017 at 9:49 Comment(0)
W
0

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.

Washtub answered 27/7, 2018 at 7:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.