Firstly, what version of iOS-SDK do you use?
Secondly, it’s a bad practice to map the “Users” table to the custom class. Please use the BackendlessUser class instead.
I’ve just checked the issue with nil with the MyQuestions class but everything works fine (iOS-SDK v 4.0.6)
class MyQuestions: NSObject {
var question: String?
}
func mapAndGetData() {
backendless.data.mapTable(toClass: "Questions", type: MyQuestions.ofClass())
let dataStore = backendless.data.of(MyQuestions.ofClass())
let questions = dataStore?.find() as! [MyQuestions]
for q in questions {
print(q.question!)
}
}
You’ve created an instance of MyQuestions class but haven’t set the question property’s value.
let myQuestion = MyQuestions()
myQuestion.question = "Test Question?"
print(myQuestion.question)
To retrieve the existing data from Backendless you should run this code:
let dataStore = backendless.data.of(MyQuestions.ofClass())
let questions = dataStore?.find() as! [MyQuestions]
for q in questions {
print(q.question!)
}
import UIKit
import Parse
class MyOrders: PFObject, PFSubclassing {
@NSManaged var orderCity: String
@NSManaged var isVisible: Bool
@NSManaged var modifiedAt: NSDate
@NSManaged var servicePrice: [[String]]
@NSManaged var orderDescription: String
@NSManaged var atHome: Bool
@NSManaged var departure: Bool
@NSManaged var geoPointOrder: PFGeoPoint
}
let myOrder = MyOrders()
print(myOrder.isVisible) -> Console.log : true
peint(myOrder.orderDescription) -> Console.log: "my order Description"
Backendless iOS-SDK is not the same as Parse SDK.
To retrieve data from database:
let dataStore = backendless.data.of(MyQuestions.ofClass())
let questions = dataStore?.find() as! [MyQuestions] // array of Questions
for q in questions {
print(q.question!)
}
Pay attention to the code in the previous comment - Backendless can all the same as Parse, and even more. But in another way.
This is an English-language forum. We ask to communicate here exclusively in English so that other our users and customers can understand what we are talking about and find a solution to the existing problem.
Yes, I have read everything, including Olga’s responses where she showed examples. Of course the implementation is different in Backendless. We’re not interested in copying parse’s implementation and thus provide our own. It is important to read the docs and see the examples we show there. Simply applying what you know about Parse with Backendless will not get you far.