Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEditor.Callbacks;
- using UnityEditor;
- using System;
- using UnityEditor.iOS.Xcode;
- using System.IO;
- // 9:03 PM 9/7/2017
- // from: https://stackoverflow.com/questions/35739361/itsappusesnonexemptencryption-export-compliance-while-internal-testing
- public class IOSBuildTools : MonoBehaviour
- {
- [PostProcessBuild]
- public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)
- {
- if (buildTarget == BuildTarget.iOS)
- {
- // Get plist
- string plistPath = pathToBuiltProject + "/Info.plist";
- var plist = new PlistDocument();
- plist.ReadFromString(File.ReadAllText(plistPath));
- // Get root
- var rootDict = plist.root;
- // // Change value of NSCameraUsageDescription in Xcode plist
- // var buildKey = "NSCameraUsageDescription";
- // rootDict.SetString(buildKey, "Taking screenshots");
- var rootValues = rootDict.values;
- rootValues.Remove("UIApplicationExitsOnSuspend");
- var buildKey2 = "ITSAppUsesNonExemptEncryption";
- rootDict.SetString(buildKey2, "false");
- var buildKey3 = "NSLocationWhenInUseUsageDescription";
- rootDict.SetString(buildKey3, "This is not required.");
- // Write to file
- File.WriteAllText(plistPath, plist.WriteToString());
- }
- if(buildTarget == BuildTarget.iOS)
- {
- string projectPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
- PBXProject pbxProject = new PBXProject();
- pbxProject.ReadFromFile(projectPath);
- System.Action<string> RemoveBitcode = (tgt) =>
- {
- pbxProject.SetBuildProperty(tgt, "ENABLE_BITCODE", "NO");
- };
- #if UNITY_2020_1_OR_NEWER
- RemoveBitcode(pbxProject.GetUnityMainTargetGuid());
- RemoveBitcode(pbxProject.GetUnityFrameworkTargetGuid());
- #else
- RemoveBitcode( pbxProject.TargetGuidByName("Unity-iPhone"));
- #endif
- pbxProject.WriteToFile (projectPath);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment