Q: How to make UITests-Runner able to access privacy-sensitive data I'm running an UITests case w/ UIImageWriteToSavedPhotosAlbum() to save my test screenshot to Photos Album:
- (void)testExample
{
  XCUIScreenshot *screenshot = [_app screenshot];
  UIImageWriteToSavedPhotosAlbum(screenshot.image, nil, nil, nil);
}

but it crashed w/ error: 

... XXXUITests-Runner[53905:8592232] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data.

I've provided both NSPhotoLibraryUsageDescription & NSPhotoLibraryAddUsageDescription to my UITest Target & App Target.
Searched for a while, I can't figure out a way to let the UITests-Runner able to save image to Photos app so far, no UI level to let me press to allow it.
So, how can I achieve this, i.e., make UITests-Runner able to access privacy-sensitive data (Photos in this case)?

Sample Project Available Here:
UITestRunnerIssueDemo
And below is the related error detail:

Test Suite 'All tests' started at 2018-05-10 11:30:37.693
  Test Suite 'UITestRunnerIssueDemoUITests.xctest' started at 2018-05-10 11:30:37.694
  Test Suite 'UITestRunnerIssueDemoUITests' started at 2018-05-10 11:30:37.694
  Test Case '-[UITestRunnerIssueDemoUITests testExample]' started.
      t =     0.00s Start Test at 2018-05-10 11:30:37.695
      t =     0.05s Set Up
      t =     0.06s     Open com.kjuly.UITestRunnerIssueDemo
      t =     0.10s         Launch com.kjuly.UITestRunnerIssueDemo
      t =     3.08s             Wait for com.kjuly.UITestRunnerIssueDemo to idle
      t =     6.10s Find the Target Application 0x60c0000dd5e0
      t =     6.25s Tear Down
  2018-05-10 11:30:43.948541+0800 UITestRunnerIssueDemoUITests-Runner[53905:8592232] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data.  


Btw, I know I can get the UITests screenshot that auto saved under AppData/Library/Snapshots folder, but it'll be convenient if I can get it from Photos Album, especially when doing so in real device, I'm not willing to download the App Container every time just for getting those screenshots (and also, I need high quality screenshot that saved).

A: I have exact same issue now, temporary workaround that work for me is to put the image save code:
  UIImageWriteToSavedPhotosAlbum(screenshot.image, nil, nil, nil);

inside the app code like when you run it in debug mode.
