声音可以工作在模拟器,然后一些声音(如循环的)已被证明不能工作,设置在模拟器中成功与否取决于音频格式.注:必须使用.wav格式在这个例子中.
SystemSoundID pmph;
id
sndpath = [[
NSBundle
mainBundle]
pathForResource:@
"mySound"
ofType:@
"wav"
inDirectory:@
"/"
];
CFURLRef baseURL = (CFURLRef) [[
NSURL
alloc] initFileURLWithPath:sndpath];
AudioServicesCreateSystemSoundID (baseURL, &pmph);
AudioServicesPlaySystemSound(pmph);
[baseURL release];
http://blog.sina.com.cn/s/blog_a250468201010ei3.html
http://blog.csdn.net/like7xiaoben/article/details/9001806
http://blog.csdn.net/like7xiaoben/article/details/8990730
http://www.cnblogs.com/wendingding/p/3900112.html