Opening Chrome breaks background audio recording

I have an app that records audio in the background after a button is pressed and that works just fine. However, if I open certain other apps like Chrome (even if I close Chrome immediately after opening). Background recording stops working and will not work again until you record again while the app is in the foreground.



Is this a known glitch that I just can't seem to find?



Here is the code I use to record:


            NSArray *pathComponents = [NSArray arrayWithObjects: [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject], @"Recording.m4a", nil];
            NSURL *outputFileURL = [NSURL fileURLWithPathComponents:pathComponents];
          
            AVAudioSession *session = [AVAudioSession sharedInstance];
            [session setCategory:AVAudioSessionCategoryRecord error:nil];
          
            NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
          
            [recordSetting setValue:[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
            [recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
            [recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
          
            if (_recorder) {
                _recorder = nil;
            }
          
            _recorder = [[AVAudioRecorder alloc] initWithURL:outputFileURL settings:recordSetting error:nil];
            _recorder.delegate = self;
            _recorder.meteringEnabled = YES;
            [_recorder prepareToRecord];
            [_recorder record];

No one has any reason for why this may be happening?

Opening Chrome breaks background audio recording
 
 
Q