ios class not found "Expected a type"

11,056

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.

Share:
11,056
Jacksonkr
Author by

Jacksonkr

Another guy in a chair with questions & answers. jacksonkr.com

Updated on June 05, 2022

Comments

  • Jacksonkr
    Jacksonkr almost 2 years

    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