Unity接入Bugly部分注意事项

主要当作备注随手记一下

1. IOS 使用XUPoter的时候,Unityframework 丢失头文件引用,引起编译错误, 最简单的方式,手动添加几个文件夹的引用, 但是如果介入了CI流程,就需要做一些修改了

PBXBuildPhase.cs 中添加 PBXHeadersBuildPhase 类型
然后在按照其他几个Phase的代码,都复制黏贴一份。
这个XUPoter 的设计思路还是挺好玩的,不认识的就不序列化了,也不管你有用没用(精彩)。

不过我按照此方法做了没球用求大佬指点。

手动在xcode中添加丢失的头文件引用设置如下:

  

2. IOS 使用XUPorter的时候,生成的项目运行时报 Class BuglyAgent is implemented in both... 类似的错误, 大概的意思就是你引用了同一个framework两次。

 在 XCProject.AddFile 做一些修改, 让主项目不要去引用Bugly.framework了

case "PBXFrameworksBuildPhase":
    foreach( KeyValuePair<string, PBXFrameworksBuildPhase> currentObject in frameworkBuildPhases )
    {    
        // 新增这个if判断
        if(filePath.Contains("Bugly/Bugly.framework") && !jumpMainProject)    
        {
            jumpMainProject = true;
            continue;
        }
        Debug.Log($"Adding Framework links {filePath}");
        BuildAddFile(fileReference,currentObject,weak);
    }
    if ( !string.IsNullOrEmpty( absPath ) && ( tree.CompareTo( "SOURCE_ROOT" ) == 0 )) {
        string libraryPath = Path.Combine( "$(SRCROOT)", Path.GetDirectoryName( filePath ) );
        if (File.Exists(absPath)) {
            this.AddLibrarySearchPaths( new PBXList( libraryPath ) ); 
        } else {
            this.AddFrameworkSearchPaths( new PBXList( libraryPath ) );  
        }
        
    }
    break;

猜你喜欢

转载自blog.csdn.net/Liumotor/article/details/116722251