Search Unity

tvOS - Add UserManagement Capability

Discussion in 'iOS and tvOS' started by erlemaitre, Jan 18, 2021.

  1. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    Hello,

    I would like to enable the User Management capability in my tvOS game, but I don't see any option for doing that inside the ProjectCapabilityManager class. Is there a way to add this capability without checking it manually in Xcode each time?
     
    Milky_Dave likes this.
  2. Milky_Dave

    Milky_Dave

    Joined:
    Jan 29, 2021
    Posts:
    2
    I have the same question/issue

    @erlemaitre did you ever resolve this?
     
  3. Milky_Dave

    Milky_Dave

    Joined:
    Jan 29, 2021
    Posts:
    2
    Just to update any future readers of this thread, here is my solution :)

    Code (CSharp):
    1.    [PostProcessBuild]
    2.     private static void OnPostProcessBuild(BuildTarget buildTarget, string path)
    3.     {
    4.         if (buildTarget == BuildTarget.tvOS)
    5.         {
    6.             string entitlementsPath = path + "/Unity-iPhone/iCloud.entitlements";
    7.             PlistDocument plistDocument = new PlistDocument();
    8.             plistDocument.ReadFromFile(entitlementsPath);
    9.             var array = plistDocument.root.CreateArray("com.apple.developer.user-management");
    10.             array.AddString("runs-as-current-user");//optional
    11.             plistDocument.WriteToFile(entitlementsPath);
    12.         }
    13.  
    14.      
     
    allergicracoon likes this.