看板 MacDev 關於我們 聯絡資訊
我用AVFoundation寫背景音樂 程式碼如下 -(void)play{ NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/MUSIC.wav" ,[[NSBundle mainBundle] resourcePath]]]; NSError *error; audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; audioPlayer.numberOfLoops= 1; [audioPlayer play]; 但run了之後卻出現Failed 以及以下訊息: Undefined symbols for architecture i386: "_OBJC_CLASS_$_AVAudioPlayer", referenced from: objc-class-ref in single_nameViewCintroller.o google找了很多跟我打的都是一樣的 是哪裡出了什麼問題麻煩大家替我解答一下 謝謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.33.77.78
dryman:Framework沒link進去吧? 09/25 08:38
lovemynina:我有把AVFoundation.framework add進frameworks裡 09/25 18:20
lovemynina:但還是一樣run不成功 怎麼會這樣 = = 09/25 18:21
ljhgc:i386,原PO是在模擬器上跑的吧 10/10 13:14
ljhgc:就錯誤訊息看起來是AVAudioPlayer不存在於i386的架構下 10/10 13:15
ljhgc:另外,模擬器不支援背景音樂播放喔 10/10 13:15