我对 Swift 和 Parse 还很陌生,但我的问题是:我下载了一个简单的 Swift/Parse 应用程序,对其进行了调整,它运行良好,直到我决定更新现有的 Parse SDK。我得到错误而不是错误,我无法让它工作。
我无法再为 currentuser 分配任何东西:
IE:
currentuser["location"] = PFGeoPoint(location: location)
currentuser["interestedCategory"] = self.pickerChoice
currentuser["locationLimit"] = Int(locationSlider.value)
我收到滚动错误(也适用于 Int 等)
SettingViewController.swift:157:50:无法分配“NSString!”类型的值 类型为 'AnyObject?
'
甚至
self.pickerChoiceRow = currentuser.objectForKey("interestedCategoryRow") as! Int
我收到以下错误消息:
SettingViewController.swift:82:36:可选类型“PFUser?”的值 未拆封;你的意思是用'!' 或者 '?'?
这也不再起作用了:
if currentuser["job1_objectId"] != nil {
......
}
因为我收到以下错误:
OverviewInsertViewController.swift:185:12:二元运算符“!=”不能应用于“AnyObject?”类型的操作数 和“零”
这也引起了问题??!
var 1_objectId:NSString! = ""
self.1_objectId = currentuser["job1_objectId"] as! NSString
var query_jobs = PFQuery(className: "Jobs")
query_jobs.getObjectInBackgroundWithId(self.1_objectId as String) {
(object: PFObject!, error: NSError!) -> Void in
if (error == nil) {
对于这些行,我收到以下错误:
OverviewInsertViewController.swift:144:77:无法将“NSString”类型的值分配给“NSString”类型的值!
OverviewInsertViewController.swift:146:32:无法使用类型为“(String,(PFObject!,NSError!)-> Void)”的参数列表调用“getObjectInBackgroundWithId”
请帮助我,旧的 Parse SDK 一切正常?!