Re: [問題] 在模擬器上有聲音進手機卻沒有聲音?!

看板MacDev作者 (Bang!)時間12年前 (2012/10/13 05:15), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串2/2 (看更多)
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

10/14 00:49, , 1F
我看不到return type耶?
10/14 00:49, 1F

10/14 04:07, , 2F
看不到? 你和xcode不是好朋友...
10/14 04:07, 2F

10/14 20:38, , 3F
我真的跟他不是很熟 T T
10/14 20:38, 3F
文章代碼(AID): #1GU8XXmd (MacDev)
文章代碼(AID): #1GU8XXmd (MacDev)