Created
September 15, 2019 07:26
-
-
Save hacha/4e9d0b8e12520ada6d34fc92e6d8140f to your computer and use it in GitHub Desktop.
iOSビルド時にAssociatedDomainsを追加するエディタスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.Callbacks; | |
using UnityEditor.iOS.Xcode; | |
public static class IOSBuildPostProcessor | |
{ | |
[PostProcessBuild] | |
public static void OnPostprocessBuild (BuildTarget target, string pathToBuiltProject) | |
{ | |
if (target == BuildTarget.iOS) | |
{ | |
OnPostprocessBuildIOS (pathToBuiltProject); | |
} | |
} | |
private static void OnPostprocessBuildIOS (string pathToBuiltProject) | |
{ | |
//This is the default path to the default pbxproj file. Yours might be different | |
string projectPath = "/Unity-iPhone.xcodeproj/project.pbxproj"; | |
//Default target name. Yours might be different | |
string targetName = "Unity-iPhone"; | |
//Set the entitlements file name to what you want but make sure it has this extension | |
string entitlementsFileName = "my_app.entitlements"; | |
var entitlements = new ProjectCapabilityManager(pathToBuiltProject + projectPath, entitlementsFileName, targetName); | |
var domain = "ここにDynamic Linksのドメインを"; | |
entitlements.AddAssociatedDomains(new string[] { "applinks:" + domain }); | |
//Apply | |
entitlements.WriteToFile(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment