我在控制器实现文件中使用以下代码来创建AVAudioRecorder的实例。
-(NSError *) createAVAudioRecorder
{
[recorder release];
recorder = nil;
NSDate *now = [NSDate dateWithTimeIntervalSinceNow:0];
NSString *calDate = [now description];
NSString *fileName = [NSString stringWithFormat:@"myfile"];
NSLog(@"%@\%@",DOCUMENTS_FOLDER,calDate);
NSString *recorderFilePath = [[NSString stringWithFormat:@"%@/%@.caf",DOCUMENTS_FOLDER, fileName] retain];
NSURL *url = [NSURL fileURLWithPath:recorderFilePath];
NSMutableDictionary *recordSettings = [[NSMutableDictionary alloc]init];
NSError *err = nil;
recorder = [[AVAudioRecorder alloc] initWithURL:url settings:recordSettings error:&err];
return nil;
}它一直给我显示以下错误:
Undefined symbols:
"_OBJC_CLASS_$_AVAudioRecorder", referenced from:
objc-class-ref-to-AVAudioRecorder in myapp.o
ld: symbol(s) not found
collect2: ld returned 1 exit status头文件如下所示:
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <CoreAudio/CoreAudioTypes.h>
@interface MyController : UIViewController<AVAudioRecorderDelegate> {
IBOutlet UIButton *recordButton;
AVAudioRecorder *recorder;
}
-(IBAction) record: (id) sender;
-(NSError *) createAVAudioRecorder;
@end发布于 2010-07-27 05:49:35
您是否已将'AVFoundation.framework‘添加到您的项目中?
编辑这里介绍了如何将框架添加到项目中。
alt text http://img.skitch.com/20100726-1pcyc79tnemqqegnram758w9q3.png
alt text http://img.skitch.com/20100726-m3j8ceei4k8w5m2cxwj9ct41us.png
https://stackoverflow.com/questions/3339180
复制相似问题