以下查询旨在列出每年评分最高的电影:
func apiToSaveData(strURL: String)
{
let myURL = URL(string: strURL)
let request = NSMutableURLRequest(url: myURL!)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Accept")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let token = "Bearer " + strToken
request.setValue(token, forHTTPHeaderField: "Authorization")
var postString: [String : String] = ["" : ""]
if let navController = self.navigationController, navController.viewControllers.count >= 2
{
//Comes from After VerifyOTP after Returning Screen
let viewController = navController.viewControllers[navController.viewControllers.count - 2]
if viewController.restorationIdentifier == "VerifyOTP"
{
postString = ["image": strEncodedImg, "name": tfName.text!, "phone": tfMobile.text!, "email": tfEmail.text!, "otp": strOTP]
}
else if viewController.restorationIdentifier == "VisitorVC"
{
let imgObj = otlBtnTakeImage.imageView?.image
let imgData: Data = UIImagePNGRepresentation(imgObj!)!
let strEncodedImg1 = imgData.base64EncodedString()
print("ENcodedImage: \(strEncodedImg1)")
postString = ["image": strEncodedImg1, "name": tfName.text!, "phone": tfMobile.text!, "email": tfEmail.text!]
}
}
}
运行它后,我得到“表m的缺少FROM子句条目”。我试图解决这个问题并继续运行在启动FROM子句之前尚未创建表的示例,但据我所知,表m已在该点之前创建。出了什么问题?