0
\$\begingroup\$

We recently updated a project to Unity 2020.1.8f1 But it will not build the xcode project for iOS because of missing plist key value pairs. This is really weird cus, before, I would build the xcode project, then fix the plist stuff, then build to iOS.

Here are the errors Im getting when I try to build.

enter image description here

WebCamTexture class is used but Camera Usage Description is empty. App will not work on iOS 10+.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean &)(at / Users / bokken / buildslave / unity / build / Modules / IMGUI / GUIUtility.cs:189)

Microphone class is used but Microphone Usage Description is empty. App will not work on iOS 10+.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

I tried adding this script to Editor folder in assets

    using UnityEngine;
    using UnityEditor;
    using UnityEditor.Callbacks;
    using System.Collections;
    using UnityEditor.iOS.Xcode;
    using System.IO;
     
    public class AddStuffToplist {
     
        [PostProcessBuild]
        public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)
        {
     
            if (buildTarget == BuildTarget.iOS) {

                Debug.Log("adding plist stuff");
                // Get plist
                string plistPath = pathToBuiltProject + "/Info.plist";
                PlistDocument plist = new PlistDocument();
                plist.ReadFromString(File.ReadAllText(plistPath));
           
                // Get root
                PlistElementDict rootDict = plist.root;

                rootDict.SetString("NSCameraUsageDescription","Natcorder unity asset uses this");
                rootDict.SetString("NSMicrophoneUsageDescription","Natcorder unity asset uses this");
                rootDict.SetString("NSPhotoLibraryUsageDescription","Natcorder unity asset uses this");

                //rootDict.SetString("Privacy - Photo Library Usage Description", "Natcorder unity asset uses this");
                //rootDict.SetString("Privacy - Microphone Usage Description", "Natcorder unity asset uses this");


                // Write to file
                File.WriteAllText(plistPath, plist.WriteToString());
            }
        }
    }

I get exactly the same errors if I use Privacy - Microphone Usage Description or NSMicrophoneUsageDescription as the key for example.

Also the debug line I added "adding plist stuff" never shows up in the console, so maybe this script is not working?

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

Ok so I had a look in build settings. I was looking to see if maybe I could set a custom info.plist file before building, like setting a custom maintemplate.gradle for Android..

and I found this...

enter image description here

Thanks unity!

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .