AVFoundation iOS 5

萝らか妹 提交于 2019-11-30 01:10:27

问题


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?


回答1:


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.




回答2:


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;
}



回答3:


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];



回答4:


I had the same error, but my code wasn't different from yours. I don't really need anything in the Security framework, but adding that framework to my project fixed this issue.



来源:https://stackoverflow.com/questions/7779851/avfoundation-ios-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!