1

我无法弄清楚一个内存泄漏。我将添加带有代码的屏幕截图和发生这种情况的标记行。

在此处输入图像描述

也许有人可以帮助我看看。

谢谢。

- (AVAudioPlayer*)getSpeachSoundObject{

    NSString *objectIDString = [NSString stringWithFormat:@"%i", jmObject.objectID];
    NSString * __weak textPlaySource = [DataController getMediaUrlStringForObjectID:objectIDString parentType:PARENT_TYPE_ITEM_AUDIO];
    NSError * error = nil ;

    if (textPlaySource) {

        //NSURL *soundURL = [[NSURL alloc] initFileURLWithPath:textPlaySource];//[NSURL fileURLWithPath:textPlaySource];
        NSData * data = [NSData dataWithContentsOfFile:textPlaySource options:NSDataReadingMapped error:&error ] ;
        textPlaySource = nil;

        NSError *error;

        //speechSound = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:&error];
        AVAudioPlayer *lspeechSound = data ? [[AVAudioPlayer alloc] initWithData:data error:&error ] : nil ;

        data = nil;

        if (error) {
            WLog([NSString stringWithFormat:@"Error creating sound file:%@", error]);
        }

        return lspeechSound;
        //soundURL = nil;
    }

    return nil;
}
4

0 回答 0