警告:'return'之后的表达式被视为'return'的参数]]

问题描述 投票:6回答:1

我在代码中收到此警告,但无法弄清楚它的含义以及修复该问题所需采取的措施。警告内容如下:

“返回”之后的表达式被视为“返回”的参数

它显示在此行上:

// Tell Realm to use this new configuration object for the default Realm

有人可以解释我在做什么错吗?请参阅下面的代码部分。

某些背景信息,该代码是数据库管理器类的一部分,如果还没有加密的数据库,我可以使用该类将未加密的领域数据库迁移到加密的数据库。如果已加密的数据库已经存在,则它将领域配置为使用该默认数据库。如果无法打开它(例如由于加密密钥错误),它将创建一个新数据库。

let exists = self.encryptedDatabaseExists(config)
if exists {
    //Try to open Realm with new config. If unsuccessful, it needs to be removed and a new one created
    do {
        _ = try RLMRealm(configuration: config)

        // Tell Realm to use this new configuration object for the default Realm
        RLMRealmConfiguration.setDefaultConfiguration(config)
        RLMRealm.defaultRealm()
    } catch let err {
        Log.error("Encrypted DB could not be opened: \(err)")
        self.createNewEncryptedDatabase(config)
    }
} else {
    self.migrateToEncryptedDatabase(config)
}

我在我的代码中收到此警告,但我无法弄清楚它的含义以及修复该问题所需采取的措施。该警告内容如下:'return'之后的表达式被视为'...

swift warnings compiler-warnings
1个回答
0
投票

快速5简单的方法就可以享受它

© www.soinside.com 2019 - 2024. All rights reserved.