我想在我的应用程序中预加载一个 *.wav 文件,因为它相当大。我想开始加载它,viewcontroller1
然后在viewcontroller15
. 我需要代码来预加载它;播放它的代码是:
CFBundleRef mainbundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef =CFBundleCopyResourceURL(mainbundle, (CFStringRef) @"america", CFSTR ("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);