我正在创建一个iOS框架(swift),我有这个函数--我用它来检索一个字典,这个字典应该包含所有的库属性(字符串)
func getPropertyList() -> [String: Any]?{
let path = Bundle.main.path(forResource: "properties", ofType: "plist")!
let dict = NSDictionary(contentsOfFile: path) as? [String: Any]
return dict
}
从test这一行中继续返回nil
Bundle.main.path(forResource: "properties", ofType: "plist")!
即使properties.plist文件在“copy Bundle Resources”内并且选择了目标成员资格
发布于 2020-11-23 19:48:24
使用
let path = Bundle(identifier:"com.example.frameworkID")!.path(forResource: "properties", ofType: "plist")!
https://stackoverflow.com/questions/64975313
复制相似问题