use*_*292 0 iphone xcode objective-c ios
我试着寻找这个问题,但似乎无法找出我做错了什么.
这是我的控制器头:
#import <UIKit/UIKit.h>
@interface BabyLearnViewController : UIViewController {
UIButton *btnImage;
MediaManager* myMediaManager;
}
@property (nonatomic, retain) IBOutlet UIButton *btnImage;
@property (retain) MediaManager* myMediaManager;
- (IBAction)setNewImage;
@end
Run Code Online (Sandbox Code Playgroud)
这是我的控制器类:
#import "BabyLearnViewController.h"
#import "MediaManager.h";
@implementation BabyLearnViewController
@synthesize btnImage;
@synthesize myMediaManager;
Run Code Online (Sandbox Code Playgroud)
我收到错误:
error: expected specifier-qualifier-list before 'MediaManager'
error: no declaration of property 'myMediaManager' found in the interface
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?通常,如果您有圆柱参考,则会出现第一个错误.'MediaManager'没有引用任何其他内容.有任何想法吗?
由于目前没有提到MediaManager类,因此在头文件编译器中使用它无法弄清楚"MediaManager"是什么并发出错误.在头文件中使用forward声明声明该类,让编译器知道MediaManager实际上是一个类:
@class MediaManager;
@interface BabyLearnViewController : UIViewController {
...
Run Code Online (Sandbox Code Playgroud)
PS作为替代方案,您可以在标题中导入MediaManager.h,但首选使用前向声明.
| 归档时间: |
|
| 查看次数: |
110 次 |
| 最近记录: |