Quote:
Originally Posted by smithdale87
That screenshot is unreadable, can you just paste some of the code where you are getting that warning.
|
You are right. Sorry about that and thank you for reviewing this so quickly.
//The error message shows up on 4 of the same lines listed below
"AudioServicesPlaySystemSound(soundID);"
The 2 part error message for all 4 of the same lines reads:
//Here is the main message
Potential leak of an object allocated on line 88 and stored into 'soundFileURLRef'
//here are the sub messages
Call to function 'CFBundleCopyResourceURL' returns a Core Foundation object with a +1 retain count (owning reference)
//AND
Object allocated on line 88 and stored into 'soundFileURLRef' is not referenced later in this execution path and has a retain count of +1 (object leaked)
//Below is the code in question
-(IBAction)Sound1 {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"Sound1", CFSTR ("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
-(IBAction)Sound2 {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"Sound2, CFSTR ("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
-(IBAction)Sound3 {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"Sound3", CFSTR ("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
-(IBAction)Sound4 {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"Sound4", CFSTR ("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
I hope this helps. I would provide a better screenshot but apparently the thread won't allow it.
Thanks for your help in advance.
Jared