English 中文(简体)
AVAudio 不释放记忆的运动员
原标题:AVAudioPlayer not releasing memory

我启动了Ivar AVAudioPlayer变量、游戏和努力释放记忆。 在释放线之后,该船的吨位为0x0。 在零线之后,它不会改变为0x0。 马达加斯加 运动员需要特别的东西才能释放自己的记忆?

audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource: @"mysound" ofType: @"aif" inDirectory:@"/"]] error: &err];
audioPlayer.numberOfLoops = 0;
audioPlayer.volume = .5;
[audioPlayer prepareToPlay];
[audioPlayer play];
[audioPlayer release];
audioPlayer = nil;
最佳回答

水井

AVAudio 律师 as声声。 在你开始玩 playing之后,你不应释放参与者,这可能导致一些与记忆有关的错误,你的音频文件也可能不会发挥作用。

你们应该通过瓦鲁乐施舍释放参与者。 详情请上answerm

希望这一帮助。

感谢

Madhup

问题回答
 - (IBAction) playaction {

        NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"songname" ofType:@"mp3"];
        NSURL *newURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
        self.soundFileURL = newURL;
        [newURL release];
        [[AVAudioSession sharedInstance] setDelegate: self];
        [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryAmbient error: nil];

    // Registers the audio route change listener callback function
    AudioSessionAddPropertyListener (
                                     kAudioSessionProperty_AudioRouteChange,
                                     audioRouteChangeListenerCallback,
                                     self
                                     );

    // Activates the audio session.

    NSError *activationError = nil;
    [[AVAudioSession sharedInstance] setActive: YES error: &activationError];

    AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: soundFileURL error: nil];
    self.appSoundPlayer = newPlayer;
    [newPlayer release];
    [appSoundPlayer prepareToPlay];
    [appSoundPlayer setVolume: 1.0];
    [appSoundPlayer setDelegate: self];
    [appSoundPlayer play];

}

这里,报到者在案头上被宣布为 the。

AVAudioPlayer *appSoundPlayer;

它是被宣布和综合的财产,也是以交易方式释放的。

[appSoundPlayer release];




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签