Search Unity

[ScreenCapture.CaptureScreenshot] Unable to save iOS device

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

  1. navesanta

    navesanta

    Joined:
    Jul 2, 2018
    Posts:
    3
    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);
    }
    environment
    Mac OS Monterey 12.1
    Platform iOS
    Unity 2021.3.2f1