Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
425 views
in Technique[技术] by (71.8m points)

ios5 - ios class not found "Expected a type"

I'm getting two problems in my FooterSelectorView.h and I have no idea why. One is a warning while the other is an error. For some reason xcode doesn't recognize FooterArchiveItemView so I'm not able to type my object as that which is causing other propblems. Has anyone ever seen anything like this before? How can I fix it?

FooterSelectorView.h

#import <UIKit/UIKit.h>
#import "FooterArchiveItemView.h"

@interface FooterSelectorView : UIImageView

// #warning Type of property 'activeItem' does not match type of accessor 'setActiveItem:'
@property (nonatomic, retain) FooterArchiveItemView *activeItem;

// #error Expected a type
- (void)setActiveItem:(FooterArchiveItemView *)activeItem_;
- (void)update;
- (CGPoint)absoluteCenterOf:(UIView *)obj;

@end

Related Classes

FooterArchiveItemView.h

#import <UIKit/UIKit.h>
#import "AutosizeableView.h"
#import "FooterArchiveView.h"

typedef void (^ DayBlock)(void);

@interface FooterArchiveItemView : AutosizeableView {
    DayBlock dayBlock;
}

@property (nonatomic, retain) IBOutlet UIButton *day;
@property (nonatomic, retain) IBOutlet UIImageView *bullet;

- (void)setDayBlock:(DayBlock)block;

@end

AutosizeableView.h

#import <UIKit/UIKit.h>

@interface AutosizeableView : UIView

@end
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

One thing I'd suggest is that you conform to the Obj-C practice, that, within header interface files, rather than importing custom classes, you forward-declare them. For example, in FooterSelectorView.h, rather than:

#import "FooterArchiveItemView.h"

Forward-declare the class:

@class FooterArchiveItemView

Then, in the implementation file (FooterSelectorView.m), you import. Observing the practice may not actually solve your issue in this case (I don't know exactly what's happening, personally I'd want to see a bit more code to hazard a guess), but it might help isolate the issue for you.

The noted exception to this rule is Apple's frameworks - those are imported into headers.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...