我正在做一个故事板教程(开始 iOS 故事板),其中一个示例程序无法编译。我之前遇到过这个问题,编译器无法识别对象类,但我找不到问题。
我错过了什么?
错误:体系结构 i386 的未定义符号:“_OBJC_CLASS_$_AudioPlayer”,引用自:MainViewController.o 中的 objc-class-ref
MainViewController.m
--------------------
#import "MainViewController.h"
@interface MainViewController ()
{
}
@end
@implementation MainViewController
@end
MainViewController.h
--------------------
#import "FlipsideViewController.h"
#import "AudioPlayer.h"
#import "PlayButton.h"
#import "Scale.h"
@interface MainViewController : UIViewController
<FlipsideViewControllerDelegate,
AudioPlayerDelegate,
PlayButtonDelegate,
UIPopoverControllerDelegate>
@end
AudioPlayer.m
-------------
#import "AudioPlayer.h"
@interface AudioPlayer () {
}
...(snip)...
@end
@implementation AudioPlayer
...(snip)...
@end
AudioPlayer.h
-------------
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioToolbox.h>
...(snip)...
@protocol AudioPlayerDelegate;
@interface AudioPlayer : NSObject <AVAudioPlayerDelegate> {
}
...(snip)...
@end
@protocol AudioPlayerDelegate <NSObject>
@required
-(void)player:(AudioPlayer *)player stateChanged:(ePlayerState)state;
@end