2
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?
「executeChange」調用的函數參數是什麼?什麼是電子郵件,fname,lname,性別,日期,country_code,電話和strDate的類型? –
withArgs []是anyObject類型,其餘名稱,名稱,性別,日期等是字符串 –
我正在使用swift數據框架 –