This is my first attempt with Parse on Swift, and I followed the quick start guide on the Parse website as shown here: https://parse.com/apps/quickstart#parse_data/mobile/ios/swift/existing
Unfortunately, I get this error: "PFObject" does not have a member named "index". I followed the code example and instructions exactly as they were written, and redid them several times, but with the same result. I really do not understand where I made a mistake with this, especially from the site. I am in Xcode 6.4 focused on iOS SDK 8.4 using version 1.8.3 of the Parse library.
This is the code in the ViewController in the viewDidLoad method (I remembered that it includes the import parameter)
let testObject = PFObject(className: "TestObject")
testObject["foo"] = "bar"
testObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
println("Object has been saved.")
}
and this is the code I added to AppDelegate. Again, I imported Parse and Bolts as indicated in the manual. This is the only code I changed, the rest is like a standard empty one-time application. I changed the application id and client key.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Parse.enableLocalDatastore()
Parse.setApplicationId("-redacted-",
clientKey: "-redacted-")
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
}
Any ideas on how I can fix this, or where I may have made a mistake?
source
share