Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone AVIOS 5基金会_Iphone_Video_Mp3_Avfoundation_Ios5 - Fatal编程技术网

Iphone AVIOS 5基金会

Iphone AVIOS 5基金会,iphone,video,mp3,avfoundation,ios5,Iphone,Video,Mp3,Avfoundation,Ios5,我在appstore上运行的应用程序使用的mp3和视频文件自iOS5更新后就无法运行了 我已经安装了xcode 4.2,并且。。。 当我在iPhone 5模拟器或设备中测试时,我得到以下错误(对于音频或视频文件): 当我在iPhone4.3模拟器或设备中尝试此功能时,它不会崩溃 我已经清理并重新导入了相关的框架,但似乎就是这样的错误 注意:我的应用程序不使用任何安全性 您能帮忙吗?我找到了解决方案:NSURL而不是NSString: NSURL *chemin = [NSURL fileURLW

我在appstore上运行的应用程序使用的mp3和视频文件自iOS5更新后就无法运行了

我已经安装了xcode 4.2,并且。。。 当我在iPhone 5模拟器设备中测试时,我得到以下错误(对于音频或视频文件):

当我在iPhone4.3模拟器设备中尝试此功能时,它不会崩溃

我已经清理并重新导入了相关的框架,但似乎就是这样的错误

注意:我的应用程序不使用任何安全性


您能帮忙吗?

我找到了解决方案:
NSURL
而不是
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];

我也有同样的错误,但我的代码和你的代码没有什么不同。我真的不需要安全框架中的任何东西,但将该框架添加到我的项目中解决了这个问题。

我刚刚找到了一个答案


如果您的应用程序在此崩溃,请在XCode 4断点选项卡中禁用所有异常。可能是SDK错误。

尝试将您的播放器设置为保留属性。我也经历过同样的情况,因为我在本地声明了我的播放器,我认为只要我声明播放器的方法超出范围,就会保留它

使玩家成为保留财产

@property (strong)AVAudioPlayer *player;
记住设置代理(self.player.delegate=self)并使用代理的方法清理:

-(void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)playedSuccessfully {
    self.player = nil;
}

对谢谢我就是这么做的。非常感谢。也为我工作。有人知道为什么会这样吗?
-(void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)playedSuccessfully {
    self.player = nil;
}