简体   繁体   English

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

[英]Type of expression is ambiguous without more context

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()
        }
    }

I have recently updated to Xcode 7.0.1 from 6.4.我最近从 6.4 更新到 Xcode 7.0.1。 Now I am having a lot of errors.现在我有很多错误。 This code shows an error:此代码显示错误:

Type of expression is ambiguous without more context表达类型不明确,没有更多上下文

in the place of withArgs : []代替withArgs :[]

Here's executeChange method signature:这是executeChange方法签名:

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

Since withArgs method parameter defined as由于withArgs方法参数定义为

withArgs: [AnyObject]

you can't have Optionals in that array.你不能在那个数组中有Optionals To make it work you'll have to unwrap them first.要使其工作,您必须先打开它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM