ios - 没有更多上下文,表达类型不明确

标签 ios swift xcode7

if personal_id == nil {

        if let err = SD.executeChange("INSERT INTO personal_info(user_id, fname, lname, gender, dob, country_code, phone, created_at) values (?,?,?,?,?,?,?,?)", withArgs: [email, fname, lname, gender, date, country_code, phone, strDate]) {
                let alert = UIAlertView()
                alert.title = "Table"
                alert.message = "Error inserting"
                alert.addButtonWithTitle("Ok")
                alert.show()
        } else{
            let alert = UIAlertView()
            alert.title = "Table"
            alert.message = "successfully inserted"
            alert.addButtonWithTitle("Ok")
            alert.show()
        }
    } else {
        if let err_update = SD.executeChange("UPDATE personal_info SET fname = ?, lname = ?, gender = ?, dob = ?, country_code = ?, phone = ?, updated_at = ? WHERE personal_info_id = ?", withArgs: [fname, lname, gender, date, country_code, phone, strDate, personal_id!]) {
                let alert = UIAlertView()
                alert.title = "Table"
                alert.message = "Error updating"
                alert.addButtonWithTitle("Ok")
                alert.show()
        } else {
                let alert = UIAlertView()
                alert.title = "Table"
                alert.message = "Record updated"
                alert.addButtonWithTitle("Ok")
                alert.show()
        }
    }

我最近从 6.4 更新到 Xcode 7.0.1。现在我犯了很多错误。此代码显示错误:

Type of expression is ambiguous without more context

代替withArgs:[]

这是 executeChange 方法签名:

public static func executeChange(sqlStr: String, withArgs: [AnyObject]) -> Int?

最佳答案

由于 withArgs 方法参数定义为

withArgs: [AnyObject]

该数组中不能有Options。为了使其正常工作,您必须先打开它们。

关于ios - 没有更多上下文,表达类型不明确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32961989/

相关文章:

ios - XCode 7 需要在 cocoapods 框架上进行代码签名吗?

ios - 如何为 Siri 快捷方式的每个自定义意图使用不同的 View Controller ?

ios - 如何格式化右边的两个UIBarButtonItems彼此相邻?

iOS 应用程序 Modbus 使用 Swift 读/写

ios - 从 View 更改 View 将出现

ios - iTunes Connect bundle ID问题

ios - ARMv7 的 OSX 交叉编译库

ios - 从FCM通知数据IOS中检索数据并打开 View Controller

ios - xcode 7.3 : Could not insert new outlet connection and deleting DerivedData doesnt work

ios - 尝试在 iOS 项目中安装 FontAwesomeSwift 时 Carthage 失败