check .app/.ipa file is build with developer sign and debug enabled app.
if above condition satisfied then below code works fine
File dir = new File(“<<.app/.ipa location>>“);
File app = new File(dir, “app name.app/.ipa”);
AppiumDriver driver;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("autoLaunch", true);
capabilities.setCapability(CapabilityType.PLATFORM, "MAC“);
capabilities.setCapability(CapabilityType.VERSION, “<>”);
capabilities.setCapability("deviceName", “device name”);
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("udid", “UDID of device“);
capabilities.setCapability("bundleId", “app bundle id“);
capabilities.setCapability("showIOSLog", true);
capabilities.setCapability("app", app.getAbsolutePath());
driver = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
Note:native app without code compilation through Xcode only be tested in real device