本文介绍: exampleusing System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;using UnityEditor.Callbacks;using UnityEditor.iOS.Xcode;using System.IO;namespace Framework.SDK{ public class PostprocessBuildForPhoto {
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using System.IO;
namespace Framework.SDK
{
public class PostprocessBuildForPhoto
{
[PostProcessBuild(500)]
public static void OnPostProcessBuild(BuildTarget target, string path)
{
if(target != BuildTarget.iOS) return;
// framework
string projPath = PBXProject.GetPBXProjectPath(path);
PBXProject proj = new PBXProject();
proj.ReadFromString(File.ReadAllText(projPath));
string targetGuid = proj.TargetGuidByName("Unity-iPhone");
//1、修改设置
//添加系统库
// GUID framework名 设置framework是require还是optional
// True if the framework is optional (i.e. weakly linked), false if the framework is required.
proj.AddFrameworkToProject(targetGuid,"AdSupport.framework", false);
proj.AddFrameworkToProject(targetGuid,"AppTrackingTransparency.framework", false);
File.WriteAllText(projPath, proj.WriteToString());
// 修改Info.plist文件
string plistPath = Path.Combine(path, "Info.plist");
PlistDocument plist = new PlistDocument();
plist.ReadFromFile(plistPath);
plist.root.SetString("NSPhotoLibraryAddUsageDescription", "");
plist.root.SetString("NSUserTrackingUsageDescription","");
plist.WriteToFile(plistPath);
}
}
}
原文地址:https://blog.csdn.net/baidu_38392815/article/details/123089226
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_41636.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。