Objective c A音频层噪音、修复

Objective c A音频层噪音、修复,objective-c,cocoa-touch,avaudioplayer,Objective C,Cocoa Touch,Avaudioplayer,我看到了很多关于AVAudioPlayer的问题,但我还没有找到答案。 首先,我描述我的问题 我有一节课 @interface Ex_1: UIView { AVAudioPlayer *player; } @property(retain, nonatomic) AVAudioPlayer *player; -(void) playSongByParameters; @end @implementation Ex_1 @synthesize player; -(void) pla

我看到了很多关于AVAudioPlayer的问题,但我还没有找到答案。 首先,我描述我的问题 我有一节课

@interface Ex_1: UIView {
   AVAudioPlayer *player;
}

@property(retain, nonatomic) AVAudioPlayer *player;

-(void) playSongByParameters;
@end

@implementation Ex_1
@synthesize player;

-(void) playSongByParameters {
    //here i download mp3 from url and then i get NSData *data
    //then
    NSError *err;
    if (player) {
         [player stop];
         [player release];
    }
    player = [[AVAudioPlayer alloc] initWithData : data : &err];
    if (!err) {
        [player prepareToPlay];
        [player play];
    }
}
@end
所以在main类中,我创建了Ex_1类的对象,有时我调用playSongByParameters方法。有时歌曲完全播放,也没问题,但有时同一首歌曲在30秒(可能更短,可能更长)内播放,然后播放速度变慢,然后出现噪音,然后播放中断。 有一次我用断点停止程序(当它出现问题时),然后我继续运行程序,歌曲播放完全没有bug和噪音。
你能告诉我有什么问题吗?(我使用非arc)

你确定你的音频文件没有损坏吗?是的,我确定,因为我播放的是一个url中的数据。