i'm fairly new to Swift and Parse, however here's my problem: I downloaded a simple Swift/Parse app, adapted it and it worked fine until I decided to update the existing Parse SDK. I get errors over errors and I can't get it to work.
I'm not able to assign anything to currentuser anymore:
i.e.:
currentuser["location"] = PFGeoPoint(location: location)
currentuser["interestedCategory"] = self.pickerChoice
currentuser["locationLimit"] = Int(locationSlider.value)
I receive rolling error (also for Int, etc)
SettingViewController.swift:157:50: Cannot assign a value of type 'NSString!' to a value of type 'AnyObject?
'
or even
self.pickerChoiceRow = currentuser.objectForKey("interestedCategoryRow") as! Int
I get following error message:
SettingViewController.swift:82:36: Value of optional type 'PFUser?' not unwrapped; did you mean to use '!' or '?'?
Also this is not working anymore:
if currentuser["job1_objectId"] != nil {
......
}
Because I receive the following error:
OverviewInsertViewController.swift:185:12: Binary operator '!=' cannot be applied to operands of type 'AnyObject?' and 'nil'
And this is also causing problems??!
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) {
For those lines I receive following errors:
OverviewInsertViewController.swift:144:77: Cannot assign a value of type 'NSString' to a value of type 'NSString!'
OverviewInsertViewController.swift:146:32: Cannot invoke 'getObjectInBackgroundWithId' with an argument list of type '(String, (PFObject!, NSError!) -> Void)'
Please help me, everything worked fine with the old Parse SDK?!