Hi,
I have my backendless tables populated with data and I am trying to load objects from backendless, but I receiving the following error:
Server reported an error: FAULT = ‘1009’ [Unable to retrieve data - unknown entity] <unable to="" retrieve="" data="" -="" unknown="" entity="">
Can someone please help?
This is my first Swift app for iOS and first time using Backendless. Any suggestions appreciated!
This is is what I have:
override func viewDidLoad() {
super.viewDidLoad()
var startTime = NSDate()
// tableView.delegate = self
// tableView.dataSource = self
backendless.initApp(APP_ID, secret:SECRET_KEY, version:VERSION_NUM)
backendless.persistenceService.of(coffee_details.ofClass()).find(
BackendlessDataQuery(), response: { (results: BackendlessCollection!) -> () in
var currentPage = results.getCurrentPage()
//println("Loaded \(currentPage.count) results objects")
println("Total results in the Backendless storage - \(results.totalObjects)")
for result in currentPage {
println("Results = \(result.name)")
}
println("Total time (ms) - \(1000*NSDate().timeIntervalSinceDate(startTime))")
}
,
error: { (var fault : Fault!) -> () in
println("Server reported an error: \(fault)")
})
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
Yes, I have tried double checking the syntax of my backendless data table and the tables are populated with records. The only response I am able to get is when change my object to Users. It’s not seeing the other tables I created.
Thanks for the article link. I am not trying to load user objects at the moment, but I will reference that tutorial in the future.
I am still not able to get any objects from my coffee_details table or any of the other tables I have populated. I only get a response when I use the Users (for testing purposes), other tables are returning that same fault error
Could you please paste the code for the coffee_details class? Also, please attach a screenshot of the coffee_details schema (Data screen > select the table > click the Schema and Permissions button).
import Foundation
class coffee_details: BackendlessEntity {
var name : String?
var objectID : String?
//var telephone : String?
var address : String?
var hours : String?
}
Thanks, Corbin. Could you please try the following changes:
Extend coffee_details from NSObject rather than BackendlessEntity
Change objectID to objectId (lower case "d")
Please let us know if it makes any difference.
Hi Corbin!
I tried your sample and on my side it works without errors: https://monosnap.com/file/cKD8Z0Uq8vpNnJsLKOFYSmmpa3TWc5
Could you check if you use correct appid and secret key?
Also will be great if you provide your appid and we will check this issue with your Backendless app.
Regards,
Kate.
Thank you for the suggestion. I didn’t know I needed to declare the two keys and version number again inside ViewDidLoad. I only put the keys and version inside the AppDelegate.swift file as constants. Let me try that later this evening once I get home. Hopefully that works!
Quick update, I was able to get responses from my data table! Thank you so much for all the help! The problem was the iOS secret key! I have another Backendless account and I got confused between the two. My fault I did not think to check the keys. I created the other account before my team mate told me he created one already with data tables populated. Rookie mistake haha.