AVAudioPlayer error loading file

Kyle Rosenbluth picture Kyle Rosenbluth · Sep 3, 2011 · Viewed 10.7k times · Source

I am trying to use the AVAudioPlayer to play a simple sound and I keep getting this error in the console:

2011-09-02 20:29:07.369 MusicLog[967:10103] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security

Here is my code that should play a sound when my button is pressed:

NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"tick" ofType:@"caf"];
NSError *error;

    NSURL *soundURL = [NSURL fileURLWithPath:soundPath];
    AVAudioPlayer *tickPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:&error];
[tickPlayer setDelegate:self];
[tickPlayer setNumberOfLoops:0];
[tickPlayer prepareToPlay];
if (tickPlayer == nil)
{
    NSLog(@"%@", [error description]);
}
else
{
    [tickPlayer play];
}

Do I somehow have the file in the wrong place? I just dragged the file into the project and selected copy if needed.

EDIT: After more testing I found that I do not get this error when running IOS 4.2 simulator, only on the IOS 5 simulator. Can I assume that this is a bug in iOS 5?

Thanks,

Answer

user453001 picture user453001 · Sep 30, 2011

I've had the same problem. It only seems to be a problem on iOS5 in simulator. I haven't tested on an iOS 5 device yet. I keep hoping XCode upgrades will make the error go away, but so far no luck.