在播放音频文件时,使用AVAudioPlayer创建对象时
_avPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:mp3URL error:&error];
报了这个错:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AVAudioPlayer", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这是没有找到这个类的错误,但我已经在头文件中#import <AVFoundation/AVFoundation.h>了,为什么还报错了?
后来发现,原来在工程中没有加入AVFoundation.framework库,
加入了这个库之后在运行就哦了!