How to take Screenshot of mobile application running on real iOS device

Hi Friends,

I am working on mobile application in iOS real device. I am trying to take screenshot of every pop up message that I am getting while testing the application.

I have used the below codes but they are not working for me.

First Code I used:

String Screenshotpath = “/Users/bhaskar/Downloads”;
File scrFile = ((TakesScreenshot)wd).getScreenshotAs(OutputType.FILE);
try {
FileUtils.copyFile(scrFile, new File(Screenshotpath+ “Summaryscreenshot.jpg”));
} catch (IOException e) {
e.printStackTrace();
}

Second Code I used:

File scrFile;
scrFile = ((TakesScreenshot)wd).getScreenshotAs(OutputType.FILE);
try {
FileUtils.copyFile(scrFile, new File("/Users/bhaskar/Downloads/Summaryscreenshottest.png"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("saved ");

Third code I used:

capability.setCapability(MobileCapabilityType.TAKES_SCREENSHOT, “true”);

Please someone help me…

did you get any solutions?