コード例 #1
0
    public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
    {
        if (target != BuildTarget.iPhone)
        {
            Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run");
            return;
        }

        // Create a new project object from build target
        XCProject_AutoPack project = new XCProject_AutoPack(pathToBuiltProject);

        // Find and run through all projmods files to patch the project.
        // Please pay attention that ALL projmods files in your project folder will be excuted!
        string[] files = Directory.GetFiles(Application.dataPath, "*.projmods", SearchOption.AllDirectories);
        foreach (string file in files)
        {
            UnityEngine.Debug.Log("ProjMod File: " + file);
            project.ApplyMod(file);
        }

        //TODO implement generic settings as a module option
        project.overwriteBuildSetting("CODE_SIGN_IDENTITY[sdk=iphoneos*]", "iPhone Distribution", "Release");

        // Finally save the xcode project
        project.Save();
    }
コード例 #2
0
ファイル: PostProcess.cs プロジェクト: mengtest/DragonBallNew
    public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
    {
        if (target == BuildTarget.Android)
        {
            FileUtility.DeleteFolder(Application.dataPath + "/Plugins/Android");
            if (BuildUtils.projectName == "Qihoo360")
            {
                //当我们在打Qihoo360包的时候 这里面做一些 操作。
            }
        }
        else if (target == BuildTarget.iPhone)
        {
            string projectName = BuildUtils.projectName;

            try {
                File.Delete(Application.dataPath + "/Plugins/iOS/APService.h");
                File.Delete(Application.dataPath + "/Plugins/iOS/Extension.mm");
                File.Delete(Application.dataPath + "/Plugins/iOS/JPushUnityManager.h");
                File.Delete(Application.dataPath + "/Plugins/iOS/JPushUnityManager.mm");
                File.Delete(Application.dataPath + "/Plugins/iOS/libPushSDK.a");
            } catch (System.Exception ex) {
                Debug.Log(ex.Message);
            }

            if (projectName.StartsWith("Spade"))
            {
                //得到xcode工程的路径
                string path = Path.GetFullPath(pathToBuiltProject);
                //创建XCode项目
                XCProject_AutoPack project = createXProj(pathToBuiltProject);
                // 编辑plist 文件
                EditorPlist(path);
                //修正代码
                EditorCode(path);
                // Finally save the xcode project
                project.Save();
            }
            else if (projectName.StartsWith("Oringinal"))
            {
            }
        }
    }
コード例 #3
0
ファイル: PostProcess.cs プロジェクト: mengtest/DragonBallNew
    //创建Xcode的工程
    static XCProject_AutoPack createXProj(string pathToBuiltProject)
    {
        // Create a new project object from build target
        XCProject_AutoPack project = new XCProject_AutoPack(pathToBuiltProject);

        // Find and run through all projmods files to patch the project.
        // Please pay attention that ALL projmods files in your project folder will be excuted!
        //在这里面把frameworks添加在你的xcode工程里面
        string[] files = Directory.GetFiles(Application.dataPath, "*.projmods", SearchOption.AllDirectories);
        foreach (string file in files)
        {
            project.ApplyMod(file);
        }

        //添加provisioning
        project.overwriteBuildSetting("PROVISIONING_PROFILE", "DisYingYou");

        //设置签名的证书, 第二个参数 你可以设置成你的证书
        project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "iPhone Distribution: Shanghai Shadow Game Network Science and Technology Co., Ltd.", "Release");
        project.overwriteBuildSetting("CODE_SIGN_IDENTITY", "iPhone Distribution: Shanghai Shadow Game Network Science and Technology Co., Ltd.", "Debug");

        return(project);
    }