public static void OnPostprocessBuild(BuildTarget buildTarget, string path) { UnityEngine.Debug.Log("Start change TencentIMSDK Setting " + path); var pathBase = path; string projPath = PBXProject.GetPBXProjectPath(path); PBXProject proj = new PBXProject(); proj.ReadFromFile(projPath); var frameTarget = proj.GetUnityFrameworkTargetGuid(); proj.AddHeadersBuildPhase(frameTarget); AddProjectSetting(proj, buildTarget, path); proj.WriteToFile(projPath); UnityEngine.Debug.Log("End change TencentIMSDK Setting"); }
public static void OnPostprocessBuildHandler(BuildTarget buildTarget, string path) { if (buildTarget == BuildTarget.iOS) { var projPath = PBXProject.GetPBXProjectPath(path); var proj = new PBXProject(); proj.ReadFromFile(projPath); #if UNITY_2019_3_OR_NEWER var targetGUID = proj.GetUnityFrameworkTargetGuid(); #else var targetGUID = proj.TargetGuidByName("Unity-iPhone"); #endif var notificationServicePlistPath = PathToNotificationService + "/Info.plist"; var notificationServicePlist = new PlistDocument(); notificationServicePlist.ReadFromFile(notificationServicePlistPath); notificationServicePlist.root.SetString("CFBundleShortVersionString", PlayerSettings.bundleVersion); notificationServicePlist.root.SetString("CFBundleVersion", PlayerSettings.iOS.buildNumber); notificationServicePlist.root.SetString("CFBundleDisplayName", PlayerSettings.iOS.applicationDisplayName); notificationServicePlist.WriteToFile(notificationServicePlistPath); var notificationServiceTarget = PBXProjectExtensions.AddAppExtension(proj, targetGUID, "notificationservice", PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.iOS) + ".bknotificationservice", notificationServicePlistPath); proj.AddHeadersBuildPhase(notificationServiceTarget); proj.AddFileToBuild(notificationServiceTarget, proj.AddFile(PathToNotificationService + "/NotificationService.h", "NotificationService/NotificationService.h")); proj.AddFileToBuild(notificationServiceTarget, proj.AddFile(PathToNotificationService + "/NotificationService.m", "NotificationService/NotificationService.m")); proj.AddFrameworkToProject(notificationServiceTarget, "NotificationCenter.framework", true); proj.AddFrameworkToProject(notificationServiceTarget, "UserNotifications.framework", true); proj.SetBuildProperty(notificationServiceTarget, "ARCHS", "$(ARCHS_STANDARD)"); proj.SetBuildProperty(notificationServiceTarget, "IPHONEOS_DEPLOYMENT_TARGET", "10.0"); proj.SetBuildProperty(notificationServiceTarget, "TARGETED_DEVICE_FAMILY", "1,2"); proj.WriteToFile(projPath); } }