@iOSXCUITFindBy Annotations don't work but the same code works when I use driver.findElement(By.accessibilityid) or even xpath

My code -
public class HomePage {

Data data;
String dataFile;
public IOSDriver<IOSElement> driver;

public HomePage(IOSDriver<IOSElement> driver, String dataFile) throws JsonParseException, JsonMappingException, IOException, InterruptedException {
	this.data = Data.get(dataFile);
	PageFactory.initElements(new AppiumFieldDecorator(driver), this);

Tried with accessibility -
@iOSXCUITFindBy (accessibility = “Jio Welcome Polys”)
private IOSElement welcomeBanner;

Tried with xpath - 

@iOSXCUITFindBy (xpath = "//XCUIElementTypeImage[@name='Jio Welcome Polys']")	
private IOSElement welcomeBanner;


None of the annotations work ^^ -
Error thrown - Can’t locate an element by this strategy: By.chained({By.AccessibilityId:
java-client : 7.0.0

It works when i use -
driver.findElementByXPath("//XCUIElementTypeImage[@name=‘Jio Welcome Polys’]").isDisplayed();

With annotation instead of accessibility try “id”

I had the same issue and found the solution:
add the following capability to your driver initialization:
capabilities.setCapability("automationName", "XCUITest")

I think you have to add that in your “dataFile” in the right format.

Explanation here: