Cannot convert value of type 'Foundation.Bundle' to expected argument type 'USmart_Go.Bundle'

XCode 15.3

What should I do? I can not edit GeneratedAssetSymbols.swift.

Replies

I can't build my project after update XCode to 15.3.

Fixed.

// 当调用YDWLocalizationHelper.Language切换语言后替换掉mainBundle为当前语言的bundle //class Bundle: Foundation.Bundle { // override func localizedString(forKey key: String, value: String?, table tableName: String?) -> String { // if let bundle = YDWLocalizationHelper.shared.language.bundle { // return bundle.localizedString(forKey: key, value: value, table: tableName) // } else { // return super.localizedString(forKey: key, value: value, table: tableName) // } // } //}

func KWLocalizedString(_ key: String, comment: String) -> String { if let bundle = YDWLocalizationHelper.shared.language.bundle { return NSLocalizedString(key, tableName: nil, bundle: bundle, value: "", comment: comment) } else { return NSLocalizedString(key, comment: comment) } }

Fixed.

//class Bundle: Foundation.Bundle {
//    override func localizedString(forKey key: String, value: String?, table tableName: String?) -> String {
//        if let bundle = YDWLocalizationHelper.shared.language.bundle {
//            return bundle.localizedString(forKey: key, value: value, table: tableName)
//        } else {
//            return super.localizedString(forKey: key, value: value, table: tableName)
//        }
//    }
//}

func KWLocalizedString(_ key: String, comment: String) -> String {
    if let bundle = YDWLocalizationHelper.shared.language.bundle {
        return NSLocalizedString(key, tableName: nil, bundle: bundle, value: "", comment: comment)
    } else {
        return NSLocalizedString(key, comment: comment)
    }
}