在播放音頻文件時,使用AVAudioPlayer建立對象時spa
_avPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:mp3URL error:&error];code
報了這個錯:對象
Undefined symbols for architecture i386:it
"_OBJC_CLASS_$_AVAudioPlayer", referenced from:io
objc-class-ref in ViewController.oclass
ld: symbol(s) not found for architecture i386import
clang: error: linker command failed with exit code 1 (use -v to see invocation)音頻
這是沒有找到這個類的錯誤,但我已經在頭文件中#import <AVFoundation/AVFoundation.h>了,爲何還報錯了?command
後來發現,原來在工程中沒有加入AVFoundation.framework庫,im
加入了這個庫以後在運行就哦了!