M3NYFAC3Z.COM
M3NYFAC3Z.COM

Reputation: 11

Can't Play Sound on Xcode iphone simulator

I am trying to play a sound thats linked to a button, but I get the following error code. How can I fixed this problem?

2012-01-13 07:22:58.887 M3NYFAC3Z[5875:1e03] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn: dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: _CFXMLNodeGetInfoPtr 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 2012-01-13 07:22:58.892 M3NYFAC3Z[5875:1e03] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn: dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: _CFXMLNodeGetInfoPtr 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 2012-01-13 07:25:28.994 M3NYFAC3Z[5875:1e03] AQMEIO_Base::DoStartIO: timeout 2012-01-13 07:25:29.271 M3NYFAC3Z[5875:1e03] AQMEDevice(0x8831a00)::StartIO: error -66681 2012-01-13 07:25:29.272 M3NYFAC3Z[5875:1e03] CA_UISoundClientBase::StartPlaying: AddRunningClient failed (status = -66681). [Switching to process 5875 thread 0x207] sharedlibrary apply-load-rules all

This is my code:

-(IBAction)playobey:(id)sender { 
    NSString *path = [[NSBundle mainBundle] pathForResource:@"renegadeyamaha" ofType:@"wav"];
    AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; 
    [audioPlayer play];
}

Upvotes: 1

Views: 3513

Answers (1)

Nick Lockwood
Nick Lockwood

Reputation: 41005

You need to keep a reference to your AVAudioPlayer in an ivar/property somewhere. It's probably being created and then released immediately before it's had a chance to finish playing your sound.

I wrote a little AVAudioPlayer-based sound player class that might make your life easier:

https://github.com/nicklockwood/SoundManager

Upvotes: 3

Related Questions