IOS native app switch

I want to switch 2 applications on 1 device on runtime.
I am trying to do this using below code:

public static void switchToAppleHealth(IOSDriver driver,String bundleId) throws MalformedURLException {
ConfigurationManager.getBundle().setProperty(bundleId, “com.apple.Health”);
DesiredCapabilities capabilities = DesiredCapabilities.iphone();
capabilities.setCapability(“bundleId”, bundleId);
driver = new IOSDriver(new URL(“https://nexperience/perfectomobile/wd/hub”), capabilities);
driver.launchApp();
}

Need help to get resolved with this issue asap