Trying to add the facility for user to turn off all sounds in my app using a ui switch. (User preferences)
- (IBAction)toggleaudio:(id)sender {
if (switchtoggle.on)
{
[self.????? play];
}
else {
[self.?????? stop];
}
}
I'm unsure what to put where the question marks are in my code. What I've tried just gives me errors. If there's a better solution I'm open to suggestions.
My code for the audio:
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"btn2", CFSTR
("mp3"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID (soundFileURLRef, &soundID);
AudioServicesPlaySystemSound (soundID);
Fixed this using NS User Defaults