AAChartKit-Swift
AAChartKit-Swift copied to clipboard
pod 安装后调用 crash
let path = Bundle.main.path(forResource: "AAChartView", ofType: "html", inDirectory: "AAJSFiles.bundle")
换成文件夹手动拖进去后没这问题 let path = Bundle.main.path(forResource: "AAChartView", ofType: "html")
不应该啊,我自己 pod 导入测试过,一切正常啊!
你 pod 导入的有 AAJSFiles.bundle 这个 bundle 文件夹吗?
有AAJSFiles.bundle这个文件夹,但就是crash,之后从Demo里拖了AAJSFiles文件夹就好了
我也遇到这个问题 原因是framework里面Bundle.main是读取主程序的资源,所以没能找到这个文件 解决办法: let path = Bundle.main.path(forResource: "AAChartView", ofType: "html", inDirectory: "AAJSFiles.bundle”)
改成
let path = Bundle(for: self.classForCoder).path(forResource: "AAChartView", ofType: "html", inDirectory: "AAJSFiles.bundle")
Same issue here. The path is nil.
I think that happens because of 'Bundle.main' gets the bundle of the project itself, not the pod bundle.