[iOS] App closes quickly once it is loaded

Hello all,

I guess the title explains it, but whenever I try and run iOS app it opens for a moment then closes instantaneously. Here’s my code:

public static void main(String[] args) throws MalformedURLException {
	// TODO Auto-generated method stub
	File app = new File("/Users/jbuoncri/Documents/Improvonia.app");
	
	DesiredCapabilities cap = new DesiredCapabilities();
	cap.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
	cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.2");
	cap.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 6s");
	cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
	//cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
	cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "15");
	//cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UIAutomation");
	
	IOSDriver iosd = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"), cap);	

If it helps I am using Xcode 8.1 as well as Appium version 1.6.3 (exe)

Open the device in Xcode and look at the crash logs. Why is the app crashing?

Have you enabled UI Automation in Developer settings on the device?
Settings > Developer > Enable UI Automation

If this is not on, as soon as you launch the app via appium it will close it

Apologies, but I was able to figure out the issue: We need to run the debug version of the app through Appium, otherwise the app will keep crashing.

Thank you wreed for the suggestion!