Unity Xcode API設定DevelopmentTeam

weixin_33727510發表於2017-01-09
            var pbxProject = new PBXProject();
            pbxProject.ReadFromFile("project.pbxproj");

            var pbxProjectData = pbxProject.GetFieldValue("m_Data");

            var project = pbxProjectData.GetFieldValue("project").GetPropertyValue("project");

            var properties = pbxProjectData.GetFieldValue("project").GetPropertyValue("project").GetFieldValue("m_Properties") as PBXElementDict;

            var targetGuid = pbxProject.TargetGuidByName("Unity-iPhone");

            var targetAttributes = properties["attributes"]["TargetAttributes"][targetGuid];
            if (targetAttributes == null)
                targetAttributes = properties["attributes"]["TargetAttributes"].AsDict().CreateDict(targetGuid);

            targetAttributes.AsDict().SetString("DevelopmentTeam", "AMSTN4PRF9");
            targetAttributes.AsDict().SetString("ProvisioningStyle", "Automatic");

            pbxProject.WriteToFile("project.pbxproj");

相關文章