Created
September 18, 2015 07:39
-
-
Save doodoori2/434909f40b0734c914d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| [PostProcessBuild(100)] | |
| public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath) | |
| { | |
| if (buildTarget != BuildTarget.iOS) | |
| { | |
| return; | |
| } | |
| var buildTargetPath = GetBuildTargetPath(); // ./build/iOS/ | |
| var xcodeprojPath = Path.Combine(Path.Combine(buildTargetPath, "Unity-iPhone.xcodeproj"), "project.pbxproj"); | |
| if (!File.Exists(xcodeprojPath)) | |
| { | |
| throw new Exception(string.Format("xcodeprojPath is null {0}", xcodeprojPath)); | |
| } | |
| PBXProject proj = new PBXProject(); | |
| proj.ReadFromFile(xcodeprojPath); | |
| var target = proj.TargetGuidByName("Unity-iPhone"); | |
| proj.AddBuildProperty(target, "ENABLE_BITCODE", "NO"); | |
| // proj.AddFrameworkToProject(target, "AdSupport.framework", true); | |
| // IGAworks | |
| proj.AddFrameworkToProject(target, "Security.framework", true); | |
| proj.AddFrameworkToProject(target, "Social.framework", true); | |
| proj.AddFrameworkToProject(target, "CoreTelephony.framework", true); | |
| proj.AddFrameworkToProject(target, "MessageUI.framework", true); | |
| proj.AddFrameworkToProject(target, "libxml2.dylib", true); | |
| proj.AddBuildProperty(target, "FRAMEWORK_SEARCH_PATHS", "$(SRCROOT)/Frameworks/Plugins/iOS/Igaworks"); | |
| proj.AddBuildProperty(target, "HEADER_SEARCH_PATHS", "$(SRCROOT)/Libraries/Plugins/iOS/Igaworks"); | |
| proj.AddBuildProperty(target, "LIBRARY_SEARCH_PATHS", "$(SRCROOT)/Libraries/Plugins/iOS/Igaworks/IgaworksCore"); | |
| proj.AddBuildProperty(target, "LIBRARY_SEARCH_PATHS", "$(SRCROOT)/Libraries/Plugins/iOS/Igaworks/LiveOps"); | |
| proj.AddBuildProperty(target, "LIBRARY_SEARCH_PATHS", "$(SRCROOT)/Libraries/Plugins/iOS/Igaworks/AdBrix"); | |
| // proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-all_load"); | |
| File.WriteAllText(xcodeprojPath, proj.WriteToString()); | |
| // add urlscheme | |
| var urlSchemeStr = GetCurrentUrlScheme(); | |
| var plist = new PlistDocument(); | |
| var plistFilePath = Path.Combine(buildTargetPath, "Info.plist"); | |
| plist.ReadFromFile(plistFilePath); | |
| // var new_dict = {'CFBundleTypeRole': 'Editor', 'CFBundleURLName': sns, 'CFBundleURLSchemes': [scheme_value]} | |
| if (null == plist.root["CFBundleURLTypes"]) | |
| { | |
| plist.root.CreateArray("CFBundleURLTypes"); | |
| } | |
| var urlTypes = plist.root["CFBundleURLTypes"].AsArray(); | |
| var urlTypeDict = urlTypes.AddDict(); | |
| urlTypeDict.SetString("CFBundleURLName", "TODO"); // PlayerSettings.bundleIdentifier | |
| urlTypeDict.CreateArray("CFBundleURLSchemes").AddString(urlSchemeStr); | |
| urlTypeDict.SetString("CFBundleTypeRole", "Editor"); | |
| // ATS setting for igaworks is working at iOS9 | |
| if (null == plist.root["NSAppTransportSecurity"]) | |
| { | |
| plist.root.CreateDict("NSAppTransportSecurity"); | |
| } | |
| var atsDictRoot = plist.root["NSAppTransportSecurity"].AsDict(); | |
| if (null == atsDictRoot["NSExceptionDomains"]) | |
| { | |
| atsDictRoot.CreateDict("NSExceptionDomains"); | |
| } | |
| var ATSExceptionDomainsDict = atsDictRoot["NSExceptionDomains"].AsDict(); | |
| if (null == ATSExceptionDomainsDict["adpopcorn.com"]) | |
| { | |
| ATSExceptionDomainsDict.CreateDict("adpopcorn.com"); | |
| } | |
| var ATSSetting1 = ATSExceptionDomainsDict["adpopcorn.com"].AsDict(); | |
| ATSSetting1.SetBoolean("NSIncludesSubdomains", true); | |
| ATSSetting1.SetBoolean("NSExceptionRequiresForwardSecrecy", false); | |
| ATSSetting1.SetBoolean("NSExceptionAllowsInsecureHTTPLoads", true); | |
| if (null == ATSExceptionDomainsDict["igaworks.com"]) | |
| { | |
| ATSExceptionDomainsDict.CreateDict("igaworks.com"); | |
| } | |
| var ATSSetting2 = ATSExceptionDomainsDict["igaworks.com"].AsDict(); | |
| ATSSetting2.SetBoolean("NSIncludesSubdomains", true); | |
| ATSSetting2.SetBoolean("NSExceptionRequiresForwardSecrecy", false); | |
| ATSSetting2.SetBoolean("NSExceptionAllowsInsecureHTTPLoads", true); | |
| plist.WriteToFile(plistFilePath); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment