Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

[ScreenCapture.CaptureScreenshot] Unable to save iOS device

Discussion in 'iOS and tvOS' started by navesanta, May 25, 2022.

  1. navesanta


    Jul 2, 2018
    It is a capture save with [ScreenCapture.CaptureScreenshot]
    It will be saved in Editor without any problem.
    But for some reason, the screenshot is not saved when I test it on my iOS device.
    The settings I made are as follows.
    1) Create an app in Unity using the following script.
    The png file was saved in Editor without any problem.
    2) In the Camera Usage Description of Player Setting for iOS
    Enter Capture Image.
    3) Create an Xcode file with File> Build Setting> Build in Menu.
    4) Open Xcode and put [Application supports iTunes files sharing] in info-plist.
    Add [Support opening Documents in place].
    Now I generated and tested Adhoc with Product> Archive but it is not saved in File.
    Could I ask the reason?
    The script is below.
    public void OnClickShot ()
    string filePath = Application.persistentDataPath + "/test.png";
    // Take a screenshot
    // Mobile platform is under persistentDataPath without permission by specifying the file name
    ScreenCapture.CaptureScreenshot (filePath);
    Mac OS Monterey 12.1
    Platform iOS
    Unity 2021.3.2f1