【问题标题】:AVAudioRecorder stops when lock button is pressed [duplicate]按下锁定按钮时AVAudioRecorder停止[重复]
【发布时间】:2012-09-18 13:23:35
【问题描述】:

可能重复:
AVAudioRecorder doesn't record while screen is locked

我正在尝试让我的录音机继续工作,即使 iPhone 像苹果的语音备忘录应用程序一样被锁定。 目前锁定按钮似乎要求我的录音机停止。

即使屏幕被锁定直到用户真正手动停止它,我该怎么做才能让记录器保持打开状态?

【问题讨论】:

    标签: iphone objective-c ios xcode avaudiorecorder


    【解决方案1】:

    您需要配置 AVAudioSession 类别。

    NSError *sessionError = nil;
    [[AVAudioSession sharedInstance] setDelegate:self]; 
    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryRecord error:&sessionError];
    

    您可以找到更多信息here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-22
      相关资源
      最近更新 更多