title: UI Testing - Access the Camera
body: <p>I get permission alert box when i first trigger the app cam on UI test on real device. To avoid crash and follow my ui test steps, i tried to the following steps. But still not working as i want. Any ideas to avoid crash?</p>
  
  <pre><code>XCUIApplication *app = [[XCUIApplication alloc] init];
  [app.buttons[@"Open Camera"] tap];
  
  XCUIElement *alert = app.alerts[@"\u201cSampleAppObjC\u201d Would Like to Access the Camera"].buttons[@"OK"];
  if (alert) {
      [alert tap];
  }
  ...
  [app.buttons[@"Flash"] tap];
  [app.buttons[@"Help"] tap];
  </code></pre>