AAChartKit-Swift icon indicating copy to clipboard operation
AAChartKit-Swift copied to clipboard

pod 安装后调用 crash

Open ccxdd opened this issue 6 years ago • 4 comments

let path = Bundle.main.path(forResource: "AAChartView", ofType: "html", inDirectory: "AAJSFiles.bundle")

换成文件夹手动拖进去后没这问题 let path = Bundle.main.path(forResource: "AAChartView", ofType: "html")

ccxdd avatar Aug 10 '18 08:08 ccxdd

不应该啊,我自己 pod 导入测试过,一切正常啊!

你 pod 导入的有 AAJSFiles.bundle 这个 bundle 文件夹吗?

AAChartModel avatar Aug 10 '18 08:08 AAChartModel

有AAJSFiles.bundle这个文件夹,但就是crash,之后从Demo里拖了AAJSFiles文件夹就好了

ccxdd avatar Aug 12 '18 09:08 ccxdd

我也遇到这个问题 原因是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")

ylqh avatar Sep 21 '18 07:09 ylqh

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.

RomuloVHSYS avatar Oct 22 '18 20:10 RomuloVHSYS