作者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
1F:推 lovemynina:我看不到return type耶? 10/14 00:49
2F:→ nobody1:看不到? 你和xcode不是好朋友... 10/14 04:07
3F:→ lovemynina:我真的跟他不是很熟 T T 10/14 20:38