My apps runing on the appstore are using mp3 and video files that don't work since iOS5 update.
I've installed xcode 4.2 and... When I test in the iPhone 5 Simulator or device I get the following error (for audio or video files):
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: ___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
When I try this in the iPhone 4.3 simulator or device it does not crash ..
I've cleaned and re import the frameworks involved but it seems to be that kind of error
Note: My apps don't use any security.
Could you help?
I just have found an answer here.
If your app crashes here, disable All Exceptions in XCode 4 Breakpoints Tab. Maybe it's SDK bug.
Try to make your player a retained property. I experienced the same and because I declared my player locally I think ARC retained as soon as the method in which I declared the player ran out of scope.
Make player a retained property
@property (strong)AVAudioPlayer *player;
Remember to set the delegate (self.player.delegate = self) and use the delegate's methods to clean up:
-(void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)playedSuccessfully {
self.player = nil;
}
I found the solution: NSURL
instead of NSString
:
NSURL *chemin = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/MySound.wav", [[NSBundle mainBundle] resourcePath]]];
NSError *error;
AVAudioPlayer* mySound = [[AVAudioPlayer alloc] initWithContentsOfURL:chemin error:&error];
mySound.delegate = self;
[chemin release];
[mySound Play];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With