private static string GetUnityIPhoneTargetGuid(string path) { var proj = new UnityEditor.iOS.Xcode.PBXProject(); proj.ReadFromString(File.ReadAllText(path)); string mainTargetGuid = null; var unityMainTargetGuidMethod = proj.GetType().GetMethod("GetUnityMainTargetGuid"); if (unityMainTargetGuidMethod != null) { mainTargetGuid = (string)unityMainTargetGuidMethod.Invoke(proj, null); } else { mainTargetGuid = proj.TargetGuidByName("Unity-iPhone"); } return(mainTargetGuid); }