iOS Find ScreenShot

Hello,

I know there are questions relating to this, but i am having problems that don’t seem to be covered. Basically i’m using Application.CaptureScreenshot(), trying to yield until the file has been created, then apply this file to a texture. Works perfectly in editor, not on iOS though. I was having trouble with the yield, so i did a test with WaitForSeconds, and it just can’t find the file. I’ve looked on the device though, and they are there, in the documents folder, as i’d expect from from what i’ve read about CaptureScreenshot.

I need to actually save the file as i want to post it to FB once i sort this out.

Any help would be GREATLY appreciated. Thanks.

IEnumerator TakeScreenshotAndLoadItIntoTexture(string filename) {
		
		
		
		Application.CaptureScreenshot(filename);
		
		
		/*while(!File.Exists(filename)){
			debugString = "Saving";
			yield return null;	
		}
		 */
		
		FileInfo info = new FileInfo(filename);
		
		while(info == null || info.Exists == false){
			debugString = "Saving";
			info = new FileInfo(filename);
			yield return null;
		}

   		debugString = "Saved";
		WWW screenShot = new WWW("file://" + filename);
		
			yield return screenShot;
			print ("Loading");
			debugString = "Loading";
		
		print("Done " + Time.time);
		
		previewTexture = screenShot.texture;

}

btw, i call it with:

StartCoroutine(TakeScreenshotAndLoadItIntoTexture(Application.persistentDataPath +"screenshot" + "_" + System.DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss") + ".png"));

The Application.captureScreenshot(“anyname.png”); save the png to documents folder itself, you don’t need to give it a path.
What you are doing here is saving a screenshot of name (Application.persistentDataPath +“screenshot” + “_” + System.DateTime.Now.ToString(“yyyy_MM_dd_hh_mm_ss”) + “.png”)
you should only pass the name…not the path to documents directory.

Please see into it.