Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.Collections;
using UnityEditor.iOS.Xcode;
using System.IO;
public class BL_BuildPostProcess
{
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
#if UNITY_IOS
if (buildTarget == BuildTarget.iOS)
{
Debug.Log("BuildTarget IOS!!");
string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
Debug.Log("PATH: " + path);
Debug.Log("PROJPATH: " + projPath);
PBXProject proj = new PBXProject();
string src = File.ReadAllText(projPath);
Debug.Log("SRC: " + src);
proj.ReadFromString(src);
string target = proj.TargetGuidByName("Unity-iPhone");
Debug.Log("TARGET" + target);
//proj.AddBuildProperty(target, "OTHER_LDFLAGS", "$(inherited)");
//proj.AddBuildProperty(target, "HEADER_SEARCH_PATHS", "$(inherited)");
//proj.AddBuildProperty(target, "OTHER_CFLAGS", "$(inherited)");
proj.UpdateBuildProperty(target, "OTHER_LDFLAGS", new string[] { "$(inherited)" }, new string[] { });
proj.UpdateBuildProperty(target, "HEADER_SEARCH_PATHS", new string[] { "$(inherited)" }, new string[] { });
proj.UpdateBuildProperty(target, "OTHER_CFLAGS", new string[] { "$(inherited)" }, new string[] { });
proj.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
string guid = proj.FindFileGuidByProjectPath("Libraries/Plugins/iOS/GPGSAppController.mm");
System.Collections.Generic.List<string> args = new System.Collections.Generic.List<string> { "-fobjc-arc" };
proj.SetCompileFlagsForFile(target, guid, args);
string dst = proj.WriteToString();
Debug.Log("DST" + dst);
File.WriteAllText(projPath, dst);
// Add url schema to plist file
string plistPath = path + "/Info.plist";
PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));
// Get root
PlistElementDict rootDict = plist.root;
rootDict.SetBoolean("UIRequiresFullScreen", true);
plist.WriteToFile(plistPath);
}
#endif
}
}
platform :ios, '7.0'
target 'Unity-iPhone' do
pod 'GooglePlayGames', '5.1.2'
end
target 'Unity-iPhone Tests' do
pod 'GooglePlayGames', '5.1.2'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.