My iOS app was working and all of a sudden I'm seeing this error: "cannot combine with previous 'type-name' declaration specifier". Any ideas on what could be causing this error?
#import "SalesAPIManager.h"
@interface SalesDelegate : NSObject { // error points to this line
__unsafe_unretained id<SalesAPIManagerDelegate> delegate_;
}
@property (unsafe_unretained, nonatomic) id<SalesAPIManagerDelegate> delegate;
- (id)initWithDelegate:(id<SalesAPIManagerDelegate>)delegate;
@end
Likewise I had a typo in a random file in the project. It was just some plain text that was accidentally placed before a comment. My suggestion to fix/find it would be to put a ; just before the statement that is flagged. This then drew a warning to the errant text when I compiled.
I saw this error when there was some dead incomplete code in my file that I'd forgotten to take out. The compiler indicated the error at the start of a method at the return type, so I spent a lot of time looking at the method declaration and call. Turned out the incorrect typo was above the method. since there was no ";" the compiler could only tell that the void keyword was misplaced.
It's one of the disadvantages of Xcode. Xcode is one of the worst IDE's ever, Apple is trying to make it better every update. But this issue raises when you add "Some word" in some places that the compiler of Xcode is not looking at it.
My case was like in image :
I forgot to delete the word RESideMenu in AppDelegate.h and the strange thing that Xcode accepts the code until the Build and when it fires error it rays it in another and not related class.
I had this same problem. It turns out I had a typo in my main.m
file. Once I cleared that up, this error went away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With