无法强制解包非可选类型的值 'String'
Cannot force unwrap value of non-optional type 'String'
if let cityDetailsPath = Bundle.main.path(forResource: "Places", ofType: "plist") {
if let cityDetails = NSArray(contentsOfFile: cityDetailsPath!) as? [[String: String]]
{
for city in cityDetails
我的行有错误:
if let cityDetails = NSArray(contentsOfFile: cityDetailsPath!) as? [[String: String]]
错误:
Cannot force unwrap value of non-optional type 'String'
删除强制展开符号!。
if let cityDetailsPath = Bundle.main.path(forResource: "Places", ofType: "plist") {
if let cityDetails = NSArray(contentsOfFile: cityDetailsPath) as? [[String: String]]
{
for city in cityDetails {
}
}
}
if let cityDetailsPath = Bundle.main.path(forResource: "Places", ofType: "plist") {
if let cityDetails = NSArray(contentsOfFile: cityDetailsPath!) as? [[String: String]]
{
for city in cityDetails
我的行有错误:
if let cityDetails = NSArray(contentsOfFile: cityDetailsPath!) as? [[String: String]]
错误:
Cannot force unwrap value of non-optional type 'String'
删除强制展开符号!。
if let cityDetailsPath = Bundle.main.path(forResource: "Places", ofType: "plist") {
if let cityDetails = NSArray(contentsOfFile: cityDetailsPath) as? [[String: String]]
{
for city in cityDetails {
}
}
}