title: iOS Screen recording detection
body: <p>I tried to detect if screen capture is on for the application for iOS 11, to detect this the <code>UIScreen.mainScreen.isCaptured</code> property is used to check if it is recorded.</p>
  
  <p>It works fine for the first launch, when the app is terminated and launched again, then the API returns NO though the screen capture is on.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>//In viewWillAppear block
  
  __block ViewController *weakSelf = self;
    [NSTimer scheduledTimerWithTimeInterval:2.0 repeats:YES block:^(NSTimer * _Nonnull timer) {
      [weakSelf screenCaptureDetection];
    }];
  
  - (void) screenCaptureDetection {
    if (@available(iOS 11.0, *)) {
      for (UIScreen *screen in [UIScreen screens]) {
        if([screen performSelector:@selector(isCaptured)]){
        //Detected YES
      }
    }
  }
  </code></pre>
  
  <p><strong>Use case scenario:</strong></p>
  
  <ol>
  <li>Launch the app </li>
  <li>Start screen recorder using the apple screen recording option</li>
  <li>The screen recorder is detected</li>
  <li>Terminate the app</li>
  <li>Repeat the step 1 and 2</li>
  <li>The screen recording is not detected, the API <code>UIScreen.mainScreen.isCaptured</code> returns NO</li>
  </ol>
  
  <p>Please suggest</p>