public static CASEditorSettings Load(bool createAsset = false)
        {
            var asset = CASEditorUtils.GetSettingsAsset("CASEditorSettings",
                                                        CASEditorUtils.editorFolderPath, typeof(CASEditorSettings), createAsset, null);

            if (asset)
            {
                return(( CASEditorSettings )asset);
            }
            return(CreateInstance <CASEditorSettings>());
        }
Ejemplo n.º 2
0
        [PostProcessBuild(47)]  //must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and that it's added before "pod install" (50)
        public static void MainPostprocess(BuildTarget target, string buildPath)
        {
            if (target != BuildTarget.iOS)
            {
                return;
            }

            // Init Settings can be null
            var initSettings   = CASEditorUtils.GetSettingsAsset(BuildTarget.iOS, false);
            var editorSettings = CASEditorSettings.Load();
            var depManager     = DependencyManager.Create(BuildTarget.iOS, Audience.Mixed, true);

            string        plistPath = Path.Combine(buildPath, "Info.plist");
            PlistDocument plist     = new PlistDocument();

            plist.ReadFromFile(plistPath);

            UpdateGADDelayMeasurement(plist, editorSettings);
            UpdateGADAppId(plist, initSettings, depManager);
            UpdateSKAdNetworksInfo(plist);
            UpdateLSApplicationQueriesSchames(plist);
            UpdateAppTransportSecuritySettings(plist);
            SetAttributionReportEndpoint(plist, editorSettings);
            SetDefaultUserTrackingDescription(plist, editorSettings);

            File.WriteAllText(plistPath, plist.WriteToString());

            var    project = OpenXCode(buildPath);
            string mainTargetGuid;
            string frameworkTargetGuid;

            GetTargetsGUID(project, out mainTargetGuid, out frameworkTargetGuid);

            EnableSwiftLibraries(buildPath, project, mainTargetGuid, frameworkTargetGuid);
            CopyRawSettingsFile(buildPath, project, mainTargetGuid, initSettings);
            SetExecutablePath(buildPath, project, mainTargetGuid, depManager);

            SaveXCode(project, buildPath);

            if (editorSettings.generateIOSDeepLinksForPromo)
            {
                ApplyCrosspromoDynamicLinks(buildPath, mainTargetGuid, initSettings, depManager);
            }

#if UNITY_2019_3_OR_NEWER
            UpdatePodfileForUnity2019(buildPath);
#endif
            Debug.Log(CASEditorUtils.logTag + "Postrocess Build done.");
        }