我在一些我认为很简单的事情上遇到了一个非常奇怪的错误。
#import <Foundation/Foundation.h>
#import "ViewController.h"
#import "GameObject.h"
@interface GameController : NSObject
@property (strong) GLKBaseEffect * effect;
@property (strong) NSMutableArray * gameObjects;
@property (strong) NSMutableArray * objectsToRemove;
@property (strong) NSMutableArray * objectsToAdd;
+ (GameController *) sharedGameController;
- (void) tick:(float)dt;
- (void) initializeGame: (ViewController*) viewcontroller;//ERROR: EXPECTED A TYPE
- (void) createObject:(Class) objecttype atPoint:(CGPoint)position;
- (void) deleteObject:(GameObject*) object atPoint:(CGPoint)position;
- (void) manageObjects;
@end
为什么会质疑“ViewController”是否是一种类型?这是一个我已经正确实现的类。它也被进口了。
编辑*
如果有帮助,这里是 ViewController.m 类。
#import "ViewController.h"
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[[GameController sharedGameController] initializeGame:self];
}
@end
编辑 2 **
和 ViewController.h 文件
#import <GLKit/GLKit.h>
#import "GameController.h"
@interface ViewController : GLKViewController
@end