This is my code:
package IOSRealDevice;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class TestReal{
public static void main(String[] args) throws MalformedURLException, InterruptedException {
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("xcodeConfigfile", "Users/karna/Desktop/Config.xcconfig");
cap.setCapability(MobileCapabilityType.PLATFORM_NAME,"iOS");
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION,"10.13");
cap.setCapability(MobileCapabilityType.DEVICE_NAME,"karnaiMac's iPhone");
cap.setCapability("xcodeOrgId", "added name XXXXX");
cap.setCapability("xcodeSigningId", "iPhone Developer");
cap.setCapability("agentPath", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj");
cap.setCapability("bootstrapPath", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent");
cap.setCapability("udid", "iphone udid xxxxxx");
cap.setCapability("keychainPath", "/Users/karna/Library/Keychains/login.keychain-db");
cap.setCapability("keychainPassword", "xxxxxx");
cap.setCapability("automationName", "XCUITest");
//xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=iphone udid' WebDriverAgent
cap.setCapability(MobileCapabilityType.APP,"/Users/karna/Library/Developer/Xcode/DerivedData/Appname-csixnohoxphlboetngjflnzcatmi/Build/Products/Debug-iphoneos/Appname.app");
IOSDriver driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
}