看板 MacDev 關於我們 聯絡資訊
AudioServicesCreateSystemSoundID是有return type的 OSStatus status = AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID); 然後看一下status是什麼? 代碼請見System Sound Services Reference -> Result Codes http://tinyurl.com/9ag6vnm ※ 引述《lovemynina (nini)》之銘言: : 以下是我的程式碼 : -(IBAction)touchbutton1 : { : CFBundleRef mainBundle = CFBundleGetMainBundle(); : CFURLRef soundFileURLRef; : soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"hit5", : CFSTR("wav"),NULL); : UInt32 soundID; : AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID); : AudioServicesPlaySystemSound(soundID); : } : 我用simulator跑,按下按鈕後是有聲音的, : 但進到手機裡後卻沒聲音了 : 我用AVAudioPlayer放背景音樂在simulator和手機裡都是OK的 : 但這個button卻沒聲音 : 為什麼會這樣呢?! : 麻煩大家了,謝謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 199.2.242.199
lovemynina:我看不到return type耶? 10/14 00:49
nobody1:看不到? 你和xcode不是好朋友... 10/14 04:07
lovemynina:我真的跟他不是很熟 T T 10/14 20:38