I'm trying to do just a real simple thing in xcode with the ios parse sdk (1.9.1). Im trying to create a variable that will store all the data I have in my parse custom object called UserRecipe
Here is what my parse set up looks like
Below is my code:
import UIKit
import Parse
//import ParseFacebookUtilsV4
import FBSDKCoreKit
import FBSDKLoginKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let userRecipe = PFObject(className: "UserRecipe")
print(userRecipe)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
In my xcode console log this is what I have being returned:
It doesnt seem to be returning my 5 recipe objects in the UserRecipe class in parse. can anyone help me out with this? Thanks in advance for any assistance
The posted code just creates a new object locally and logs it to the console. In order to see the objects stored in the remote data, you'll need to query them.
Read all about it here, but to summarize...
var query = PFQuery(className:"UserRecipe")
query.findObjectsInBackgroundWithBlock {
(objects: [PFObject]?, error: NSError?) -> Void in
if error == nil {
if let objects = objects {
for object in objects {
print(object["recipeName"])
}
}
} else {
print("Error: \(error!) \(error!.userInfo)")
}
}