当我尝试使用以下代码访问项目中的文件时,我不断收到 nil 路径:
let path: String
if let pathOfFile = Bundle.main.path(forResource: "comfortJH", ofType: "csv")
{
path = pathOfFile
}
let stream = InputStream(fileAtPath: path)
I have checked my target memberships for the file.
I have also checked that it appears in "Copy Bundle Resources".
为什么会发生这种情况?
最佳答案
关于swift - Bundle.main.path 返回 nil,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50476931/