I have a Problem with Xcode:
At the moment I am working on an application for iOS SDK 6.1. Somedays ago I was implementing some methods and tried to compile the project. Then something strange happened:
Compilation failed and I got some errors (see picture below) in two files, which aren't related to the methods I worked on.
I searched for errors in my code but couldn't find any.
Then I closed the project and opened it again: They were still here.
Then I closed the project and Xcode and reopened both: They were still here.
Then I created a new project and copied all the code: The issue appeared again.
Now I am stuck and have no clue what to do. Do I miss something in my code?
Please help me!
EDIT 1:
Here are some code snippets, which should show my code after I followed the suggestions of Martin R:
// PlayingCardDeck.h
@class PlayingCard;
@interface PlayingCardDeck : NSObject
- (void) addCard: (PlayingCard *) card atTop: (BOOL) atTop;
- (PlayingCard *) drawRandomCard;
- (BOOL) containsCard: (PlayingCard *) card;
- (BOOL) isCardUsed: (PlayingCard *) card;
- (void) drawSpecificCard: (PlayingCard *) card;
- (void) reset;
@end
// PlayingCardDeck.m
#import "PlayingCardDeck.h"
@interface PlayingCardDeck()
// PlayingCard.h
#import <Foundation/Foundation.h>
#import "RobinsConstants.h"
#import "PlayingCardDeck.h"
//@class PlayingCardDeck;
@interface PlayingCard : NSObject
+ (NSArray*) suitStrings;
+ (NSArray*) rankStrings;
+ (NSUInteger) maxRank;
- (id)initCardWithRank: (NSUInteger) r andSuit: (NSString*) s;
- (NSString*) description;
- (NSUInteger) pokerEvalRankWithDeck: (PlayingCardDeck *) deck;
- (NSAttributedString *) attributedContents;
- (BOOL) isEqual:(PlayingCard*)object;
@property (strong, nonatomic) NSString *contents;
@property (nonatomic, getter = isUsed) BOOL used;
@property (nonatomic, readonly) NSInteger rank;
@property (nonatomic, readonly, strong) NSString * suit;
@end
// PlayingCard.m
#import "PlayingCard.h"
@interface PlayingCard()
That looks like a typical "import cycle":
// In PlayingCardDeck.h:
@import "PlayingCard.h"
// In PlayingCard.h:
@import "PlayingCardDeck.h"
Replacing one of the @import
statements by @class
should solve the problem, e.g.
// In PlayingCardDeck.h:
@class PlayingCard; // instead of @import "PlayingCard.h"
And in the implementation file you have to import the full interface:
// In PlayingCardDeck.m:
#import "PlayingCardDeck.h"
#import "PlayingCard.h" // <-- add this one
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