前言:unity出ios包的时候,xcode工程都需要设置一些参数,特别是接入一些第三方的SDK
的时候,需要引入一些新的库,每次出包,都需要操作一次,很麻烦,于是这算是一个自动出包的工具
主要使用类是PBXproject类
[PostProcessBuild()]
public static void OnPostProcessBuild(BuildTarget target, string xcodeprojectpath)
OnPostProcessBuild构建玩xcode工程后,回调
1.AddCapabilityToPbx 添加授限:
高于unity2017可直接使用 pbxProject.AddCapability(IPHONE_GUID,PBXCapabilityType.SignInWithApple);
我的版本校旧,使用以下方法,文件路径 xcodeprojectpath/Unity-iPhone/xxx.entitlements
PlistDocument tempEntitlements = new PlistDocument();
Dictionary<string, PlistElementArray> capabilityList = new Dictionary<string, PlistElementArray>();
capabilityList[你要填的key] = (tempEntitlements.root[你要填的key] = new PlistElementArray()) as PlistElementArray;
capabilityList[你要填的key].values.Add(new PlistElementString(你要填的Value));
tempEntitlements.WriteToFile(xcodep