A name of type ViewController is not recognized in one class, but is it in another?

I get a semantic build error in Xcode when I try to build my project. I have 3 NSOperationclasses setup to download information from the Internet, process it and send it to the parent view controller, an instance ViewController. Here is the code for the working class:

#import <Foundation/Foundation.h>
#import "ViewController.h"

@interface ImageGetter : NSOperation

@property (nonatomic) int sid;
@property (nonatomic, retain) ViewController* pvc;

@end

Here is the code for the one that doesn't work:

#import <Foundation/Foundation.h>
#import "ViewController.h"

@interface CurrentGetter : NSOperation

@property (nonatomic) int sid;
@property (nonatomic, retain) ViewController* pvc;

@end

Error:

ERROR: Unknown type name 'ViewController'; did you mean 'UIViewController'?

Why am I getting this error? I imported ViewController.h into both files and only one works.

ViewController.h:

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MediaPlayer.h>

#import "DataGetter.h"
#import "CurrentGetter.h"
#import "AppDelegate.h"

@interface ViewController : UIViewController <UITabBarDelegate>
{
    NSTimer* tmr;
}

@property (nonatomic) float max;
@property (nonatomic, retain) NSDictionary* plist;
@property (nonatomic, retain) NSArray* processingobj;

@property (nonatomic, retain) AVAudioPlayer* intro;
@property (nonatomic, retain) AVAudioPlayer* woop;

@property (nonatomic) float dataDone;
@property (nonatomic) BOOL introDone;
@property (nonatomic) BOOL currentDone;

@property (nonatomic) int newSid;
@property (nonatomic) int newPart;

@property (nonatomic, retain) NSMutableArray* views;

@property (nonatomic) int audioTab;
@property (nonatomic) int currentSid;
@property (nonatomic) BOOL isPlaying;

@property (nonatomic, retain) UIScrollView* partTab;
@property (nonatomic, retain) NSMutableArray* nowPlayingObj;
@property (nonatomic, retain) UINavigationBar* audioNav;

@property (nonatomic, retain) MPMoviePlayerController* player;
@property (nonatomic, retain) UILabel* elapsed;
@property (nonatomic, retain) UILabel* remaining;
@property (nonatomic, retain) UISlider* slider;
@property (nonatomic) BOOL sliderEditing;
@property (nonatomic, retain) UIButton* playBtn;

@property (nonatomic, retain) UITabBar* tabBar;

//Images

@property (nonatomic, retain) UIImage* announcement;
@property (nonatomic, retain) NSMutableArray* seriesBanners;
@property (nonatomic, retain) UIProgressView* prog;

- (void)plistDone;

@end
+5
source share
1 answer

Try making a declaration before the class in the CurrentGetter header file, for example:

@class ViewController;
@interface CurrentGetter : NSOperation

, "ViewController". , , , .

+12

All Articles