internal static void GenerateAppleAppendix(string applicationPath, string guid)
        {
            try
            {
                MobileHelper.RegisterPlatformUtilities(new AppleUtilities());
                using (var archive = ZipFile.OpenRead(applicationPath))
                {
                    var guidFile = archive.Entries.FirstOrDefault(x => x.Name == "UnityBuildGuid.txt");
                    if (guidFile == null)
                    {
                        Debug.LogError("The provided application was built before BuildReportInspector package was added to the project.");
                        return;
                    }

                    using (var reader = new StreamReader(guidFile.Open()))
                    {
                        var applicationGuid = reader.ReadToEnd();
                        if (applicationGuid != guid)
                        {
                            Debug.LogError($"The GUID of the selected report does not match the GUID of the provided application.\nExpected: {guid} but got: {applicationGuid}.");
                            return;
                        }
                    }
                }

                GenerateMobileAppendix(applicationPath, guid);
            }
            catch
            {
                Debug.LogError("Could not open the application archive. Please provide a valid .ipa bundle.");
            }
        }
        private static void BuildPostProcess(BuildTarget target, string applicationPath)
        {
            if (!File.Exists(applicationPath) || target != BuildTarget.Android || string.IsNullOrEmpty(s_LastBuildGuid))
            {
                return;
            }

            // On Android, generate the mobile appendix right after the build finishes.
            MobileHelper.GenerateAndroidAppendix(applicationPath, s_LastBuildGuid);
        }
        internal static void GenerateAppleAppendix(string applicationPath, string guid)
        {
            var temporaryFolder = Utilities.GetTemporaryFolder();

            try
            {
                MobileHelper.RegisterPlatformUtilities(new AppleUtilities());
                using (var archive = new ZipBundle(applicationPath))
                {
                    var guidFile = archive.Entries.FirstOrDefault(x => x.Name == "UnityBuildGuid.txt");
                    if (guidFile == null)
                    {
                        Debug.LogError("The signature of the opened build report doesn't match the provided application.");
                        return;
                    }

                    var guidUnzipped = Path.Combine(temporaryFolder, "UnityBuildGuid.txt");
                    AppleUtilities.UnzipFile(applicationPath, guidFile.FullName, guidUnzipped);
                    using (var reader = new StreamReader(guidUnzipped))
                    {
                        var applicationGuid = reader.ReadToEnd();
                        if (applicationGuid != guid)
                        {
                            Debug.LogError($"The GUID of the selected report does not match the GUID of the provided application.\nExpected: {guid} but got: {applicationGuid}.");
                            return;
                        }
                    }
                }

                GenerateMobileAppendix(applicationPath, guid);
            }
            catch
            {
                Debug.LogError("Could not open the application archive. Please provide a valid .ipa bundle.");
            }
            finally
            {
                Directory.Delete(temporaryFolder, true);
            }
        }
 internal static void GenerateAndroidAppendix(string applicationPath, string guid)
 {
     MobileHelper.RegisterPlatformUtilities(new AndroidUtilities());
     GenerateMobileAppendix(applicationPath, guid);
 }