[UnityEditor.Callbacks.PostProcessBuild(1002)]
public static void OnPostprocessBuild (UnityEditor.BuildTarget BuildTarget, string path){
if (BuildTarget == UnityEditor.BuildTarget.iOS) {
UnityEngine.Debug.Log ("OnPostprocessBuild add_dylib:" + path);
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
{
string projPath = UnityEditor.iOS.Xcode.PBXProject.GetPBXProjectPath (path);
UnityEditor.iOS.Xcode.PBXProject proj = new UnityEditor.iOS.Xcode.PBXProject ();
proj.ReadFromString (System.IO.File.ReadAllText (projPath));
// string targetGuid = proj.TargetGuidByName (UnityEditor.iOS.Xcode.PBXProject.GetUnityTargetName ()); // 2018
string targetGuid = proj.GetUnityMainTargetGuid(); // 2019
// 가져오기한 framework에 따라 삭제
string[] framework_names = {
"libgme_fdkaac.framework",
"libgme_lamemp3.framework",
"libgme_ogg.framework",
"libgme_soundtouch.framework"
};
for (int i = 0; i < framework_names.Length; i++)
{
string framework_name = framework_names[i];
string dylibGuid = null;
dylibGuid = proj.FindFileGuidByProjectPath("Frameworks/Plugins/iOS/" + framework_name);
if (dylibGuid == null) {
UnityEngine.Debug.LogWarning (framework_name + " guid not found");
} else {
UnityEngine.Debug.LogWarning (framework_name + " guid:" + dylibGuid);
// proj.AddDynamicFramework (targetGuid, dylibGuid);
UnityEditor.iOS.Xcode.Extensions.PBXProjectExtensions.AddFileToEmbedFrameworks(proj, targetGuid, dylibGuid);
proj.AddBuildProperty(targetGuid, "LD_RUNPATH_SEARCH_PATHS", "@executable_path/Frameworks");
System.IO.File.WriteAllText (projPath, proj.WriteToString ());
}
}
}
#endif
}
}
문제 해결에 도움이 되었나요?