RePlayKit:screen recording method return sampleBuffer is nil

I want record screen in my app,the method startCaptureWithHandler:completionHandler:,the sampleBuffer, It is supposed to exist but it has become nil.Not only that,but there‘s another problem,when I want to stop recording and save the video,I will check [RPScreenRecorder sharedRecorder].recording first, it will be false sometime,that problems are unusual in iOS 18.3.2 iPhoneXs Max,and unexpected,here is my code

   -(void)startCaptureScreen {
NSLog(@"AKA++ startCaptureScreen");
if ([[RPScreenRecorder sharedRecorder] isRecording]) {
return;
}

 //屏幕录制

[[RPScreenRecorder sharedRecorder]setMicrophoneEnabled:YES];
NSLog(@"AKA++ MicrophoneEnabled AAAA startCaptureScreen");
[[RPScreenRecorder sharedRecorder]setCameraEnabled:YES];
[[RPScreenRecorder sharedRecorder] startCaptureWithHandler:^(CMSampleBufferRef  _Nonnull sampleBuffer, RPSampleBufferType bufferType, NSError * _Nullable error) {

if(self.assetWriter == nil){

    if (self.AVAssetWriterStatus == 0) {
        [self setupAssetWriterAndStartWith:sampleBuffer];
    }
    
}
if (self.AVAssetWriterStatus != 2) {

    return;
}
if (error) {
// deal with error
    return;
}
if (self.assetWriter.status != AVAssetWriterStatusWriting) {
   
    [self assetWriterAppendSampleBufferFailWith:bufferType];
    return;
}


if (bufferType == RPSampleBufferTypeVideo) {
    

    if(self.assetWriter.status == 0 ||self.assetWriter.status > 2){

    } else if(self.videoAssetWriterInput.readyForMoreMediaData == YES){

        BOOL success =  [self.videoAssetWriterInput appendSampleBuffer:sampleBuffer];
 
        }

    }
    
   



if (bufferType == RPSampleBufferTypeAudioMic) {
    if(self.assetWriter.status == 0 ||self.assetWriter.status > 2){
        
    } else if(self.audioAssetWriterInput.readyForMoreMediaData == YES){
        
        BOOL success = [self.audioAssetWriterInput appendSampleBuffer:sampleBuffer];
        
        
        
    }
    
}


} completionHandler:^(NSError * _Nullable error) {


    //deal with error
   }];
 }

and than ,when want to save it :

 -(void)stopRecording {

 if([[RPScreenRecorder sharedRecorder] isRecording]){
  // The problem is sporadic,recording action failed,it makes me confused 
 }
   [[RPScreenRecorder sharedRecorder] stopCaptureWithHandler:^(NSError * _Nullable error) {
     if(!error) {
       //post message
        }
  }];
 }
RePlayKit:screen recording method return sampleBuffer is nil
 
 
Q