【发布时间】:2012-05-06 16:12:36
【问题描述】:
我正在使用...播放系统声音
NSString *path = [NSString stringWithFormat:@"%@%@",
[[NSBundle mainBundle] resourcePath],
@"/heartbeat.wav"];
//declare a system sound id
SystemSoundID soundID4;
//Get a URL for the sound file
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
//Use audio sevices to create the sound
AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef)filePath, &soundID4);
//Use audio services to play the sound
AudioServicesPlaySystemSound(soundID4);
AudioServicesDisposeSystemSoundID(soundID4);
我不确定这是不是问题.. 但如果它使用“分析”运行,它就会出现潜在的泄漏。随着我在模拟器中运行的次数越来越多,应用程序变得越来越慢,显然存在某种泄漏。我找到了如何在不使用 arc 的情况下处理此问题的示例,但没有。任何建议将不胜感激。
【问题讨论】:
-
您可以将此文件的 ARC 作为 B 计划关闭
-
是的,我考虑过……这会导致对事情的重大重写,就像我设置的那样。
标签: xcode memory automatic-ref-counting instruments