Unity 6.3
0 онлайн 90 гостей 3 в системе
Вход

PBXProject.AddFrameworksBuildPhase

Declaration

public string AddFrameworksBuildPhase(string targetGuid);

Параметры

Параметр Описание
targetGuid GUID объекта, например, возвращаемый TargetGuidByName.

Возвращаемое значение

строка Возвращает GUID нового этапа.

Описание

Создает новую фазу сборки фреймворка для заданной цели.

Если фаза сборки framework уже настроена для целевого объекта, функция возвращает существующую фазу.

Новая фаза помещается в конец списка фаз сборки, настроенных для целевого объекта.

using UnityEditor;
using System.IO;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;

public class Sample_AddFrameworksBuildPhase { [PostProcessBuild] public static void OnPostprocessBuild(BuildTarget buildTarget, string pathToBuiltProject) {

// Stop processing if build target is not iOS if (buildTarget != BuildTarget.iOS) return;

// Initialize PBXProject string projectPath = PBXProject.GetPBXProjectPath(pathToBuiltProject); PBXProject pbxProject = new PBXProject(); pbxProject.ReadFromFile(projectPath);

// Get GUID of the target you want to add the Framework Build Phase to string mainTargetGuid = pbxProject.GetUnityMainTargetGuid();

// Add the Framework Build Phase. Note that if this phase already exists, the function doesn't create a new one and returns GUID to the existing phase pbxProject.AddFrameworksBuildPhase(mainTargetGuid);

// Apply changes to the pbxproj file pbxProject.WriteToFile(projectPath); } }