0

启动我的应用程序时发生错误:

    malloc: *** mmap(size=2147483648) failed (error code=12)]n
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

我怀疑这是由于初始化不当造成的,但我不太确定。

- (void)loadSoundWithUrl:(NSURL *)url isLocal:(BOOL)isLocal
{
    if (!url)
        return;

    self.player = [[AVPlayer alloc] initWithURL:url];
    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
    [[AVAudioSession sharedInstance] setActive:YES error:nil];
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];

    [self.playBackTimer invalidate];
    self.playBackTimer = [NSTimer scheduledTimerWithTimeInterval:0.9
                                                          target:self
                                                        selector:@selector(playBackTimerMethod:)
                                                        userInfo:self
                                                         repeats:YES];

    if (self.isPlay)
        [self playCommand];

}

这是我初始化哪个 Avplayer 的函数,你能帮我吗,因为我不知道在给定的情况下该怎么做。

4

0 回答 0