- Home /
Running Camera roll from unity app
In an app we're currently working on porting to IOS, we want to save a screenshot and then allow the user to immediately view the saved screenshot.
In Android/Windows this works by simply using Application.openURL(...), yet in IOS this doesn't appear to be doing anything
(we're using a 3rd party plugin that saves the image and then runs a callback with the saved file path)
This is the code that functions as expected on the Windows version of the Unity editor and Android (opening the file in photo viewer/gallery once the function is called):
public void openFile()
{
if (Application.platform == RuntimePlatform.Android) //open the file on android
{
string tgt = fileToOpen.Trim('/');
Debug.Log("Opening " + tgt);
Application.OpenURL(tgt);
}
else //open the file in the editor (only functions in windows)
{
string tgt = "file://" + fileToOpen.Trim('/');
Debug.Log("Opening " + tgt);
Application.OpenURL(tgt);
}
}
FileToOpen is constructed like this:
Application.PersistentDataPath+"/"+albumname+"/"+filename+".png"
We've also noticed that IOS claims the fileToOpen path is:
/Users/[username]/Library/Application Support/[company name]/[project name]/[albumname]/[filename].png
Yet the file is saved to
/Users/[username]/[project name]/[albumname]/[filename].png
(Note that /Users/[username]/[project name] is the source code path for the project, and the paths are correct on Windows and Android)
TL;DR: I save a .png file to the Camera Roll in iOS. Then when I ask it to open this .png file, nothing happens. I want to open the Camera Roll and view this file, not in my app but in the iOS Camera Roll app.
Your answer
![](https://koobas.hobune.stream/wayback/20220613200748im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
capture the screenshot to iPhone photo gallery 2 Answers
Unity iOS sdk question 1 Answer
iOS Shader - Emulator vs Device Inconsistency 0 Answers
WebCamTexture and VSync (iPhone 4) 3 Answers
Depth of Field Mobile 0 Answers