Search Unity

Missing permissions with CloudBuild on iOS

Discussion in 'Unity Build Automation' started by Tagazou, Nov 19, 2018.

  1. Tagazou

    Tagazou

    Joined:
    Mar 27, 2017
    Posts:
    3
    Hi,
    I'm having troubles with my game that uses Vuforia to do Augmented Reality since I've updated from Unity 2017.4.1f1 to Unity 2018.2.15f1

    When I export an xcode project from Unity and then launch it on my iOS device, everything is fine, camera permission is asked at the beginning and Vuforia works flawlessly.

    However, if I use CloudBuild to generate the package, the camera permission is never asked and therefore Vuforia isn't working.

    I already tried this kind of fix without success
    https://forum.unity.com/threads/missing-camera-permissions-in-ios.446033/

    I didn't had this issue before the migration to Unity 2018, and I can't figure what to do.

    Thanks for any help :)
     
  2. MechEthan

    MechEthan

    Joined:
    Mar 23, 2016
    Posts:
    166
    That plist modification approach should work, in general. Here's what we use for Photo library:

    Code (CSharp):
    1.  
    2. public void OnPostprocessBuild(BuildReport report)
    3. {
    4.     // Open the Info.plist
    5.     string pathToBuildProject = report.summary.outputPath;
    6.     var plistPath = Path.Combine(pathToBuiltProject, "Info.plist");
    7.     var plist = new PlistDocument();
    8.     plist.ReadFromFile(plistPath);
    9.  
    10.     // Set photo gallery permission string
    11.     plist.root.SetString("NSPhotoLibraryUsageDescription", "Your photo library permission string here");
    12.  
    13.     // Apply settings to Info.plist
    14.     plist.WriteToFile(plistPath);
    15. }
    For 2018, this code should live in a class's OnPostprocessBuild function like documented here: https://docs.unity3d.com/ScriptReference/Build.IPostprocessBuildWithReport.OnPostprocessBuild.html