我有一個Unity3D iOS項目,我使用Game Center和應用程序內購買(通過第三方插件),但是當我將Unity3D項目構建到xCode時,在功能部分中的遊戲中心和應用程序內購買被禁用。我需要在PostProcessBuild方法中啓用它們。我想通過這個代碼使用xCodeApi:在後期處理中啓用Unity3D xCode項目的功能
string projPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
PBXProject proj = new PBXProject();
proj.ReadFromString(File.ReadAllText(projPath));
string target = proj.TargetGuidByName("Unity-iPhone");
proj.AddCapability (target, PBXCapabilityType.GameCenter);
proj.AddCapability (target, PBXCapabilityType.InAppPurchase);
File.WriteAllText(projPath, proj.ToString());
但這Xcode中後,仍無法打開創建的項目(它只是崩潰immidietly)。如何在xCode中手動添加這兩個功能?