Last active
March 18, 2017 13:32
-
-
Save valyrie97/06f75d346e7591b9759112cd26de9d5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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