- Home /
Application.CaptureScreenshot() on iOS not creating file.
I made an extremely simple test scene with a button that calls Application.CaptureScreenshot("test.png"). On the computer this works fine: it saves a screenshot called test.png to the root of the program. However, on iOS the file doesn't exist anywhere on the device (tried a full file search on it). The API doesn't say, but apparently it's supposed to save to the devices Documents folder:
http://ralphbarbagallo.com/2012/04/09/3-ways-to-capture-a-screenshot-in-unity3d/ http://answers.unity3d.com/questions/322677/ios-find-screenshot.html http://forum.unity3d.com/threads/capture-screenshot-from-iphone-and-save-it-in-documents-folder.85607/
Using the devices built-in screenshot shortcut works fine (home+power button).
I've tried 2 different iPads and it doesn't work on either.
EDIT: I discovered there's actually more than one documents folder (one for the iPad and then one per app), but neither contains the screenshots. I also discovered that the search function I've been using in iExplorerer doesn't work properly so the screenshots might be saving somewhere that I can't find. Any suggestions?
Okay.. I think you are not using any iOS UI references.. are you?
I don't know what you mean so I'm assu$$anonymous$$g, no?
Ugh bumped every day for 8 days and no solutions? This is honestly extremely baffling considering how simple this is supposed to be.
$$anonymous$$nowing apple, I'm thinking maybe it has something to do with a security limitation? I have no idea.
Answer by Lancemaker_ · Aug 12, 2015 at 10:43 PM
hello Try this : http://answers.unity3d.com/questions/731509/applicationcapturescreenshot-doesnt-save-anything.html
i looked at unity documentation and it has the parameter filename on it. So just add the System.IO and test it with a path.
Yeah i DID include System.IO otherwise it would throw me a syntax error. I discovered there's actually more than one documents folder (one for the iPad and then one per app), but neither contains the screenshots. I also discovered that the search function I've been using in iExplorerer doesn't work properly so the screenshots might be saving somewhere that I don't see.
I also tried just saving a simple txt file and I cant find that anywhere on the device either.
Answer by Dave-Carlile · Aug 24, 2015 at 08:07 PM
From the documentation: "On mobile platforms the filename is appended to the persistent data path."
Have you tried logging the value of Application.persistentDataPath? That should tell you where it's being saved.