作者ksksBangBang (Bang!)
看板MacDev
標題Re: [問題] 在模擬器上有聲音進手機卻沒有聲音?!
時間Sat Oct 13 05:15:10 2012
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