My program has a memory leak
问题 -(IBAction)play2; { CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef soundFileURLRef; soundFileURLRef =CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"Bear3", CFSTR ("wav"), NULL); UInt32 soundID; AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID); AudioServicesPlaySystemSound(soundID); } This is giving me an error: potential leak of an object allocated " CFBundleResourceURL returns a Core Foundation object with a +1 retain count 回答1: AudioServicesCreateSystemSoundID