Example to try
// Java
@Step("Tap 'Accept permissions' button")
public boolean tapAcceptPermissionsButton() {
Logger.log();
final String iosLocator = "**/XCUIElementTypeButton[`name == \"Allow While Using App\" OR name == \"Allow\"`]";
boolean bool = false;
// https://appium.github.io/appium-xcuitest-driver/7.3/reference/settings/
try {
driver.setSetting("acceptAlertButtonSelector", iosLocator);
} catch (Exception ignored) {
}
try {
driver.switchTo().alert().accept();
bool = true;
} catch (Exception ignored) {
}
return bool;
}