Hello, I’m using the iOS SDK version 4.0.6 and when I do a retrieving some of the fields are empty.
I have the following class:
class Photo: NSObject {
var objectId: String?
var title: String?
var location: GeoPoint?
var imageUrl: String?
var username: String?
var datetime: Date?
var address: String?
var user: BackendlessUser?
var isVideo: String?
var videoThumbnail: String?
var voiceNoteUrl: String?
}
And both vars location and user are been nil when retrieving the data. Is like the “Autoload” option is disable, but I can asure you that is on.
I’m getting the error “FAULT = ‘Server.Processing’ [exception during method invocation]” when trying to save an object of the type Photo.
Using the version 3 of the sdk never got this problem.
Thanks for the help.
Firstly, please update to the latest version of iOS-SDK (4.0.7).
I’ve checked this issue and everything looks fine.
Screenshot 1 - photos retrieving (only one photo from the retrieved photos), all relations are in place.
Here is the code:
func getPhotos() {
let photoStore = backendless.data.of(Photo.ofClass())!
let photos = photoStore.find() as! [Photo]
for photo in photos {
print("***** PHOTO *****")
print(photo.objectId!)
print(photo.title!)
print(photo.location!)
print(photo.imageUrl!)
print(photo.username!)
print(photo.datetime!)
print(photo.address!)
print(photo.user!)
print(photo.isVideo!)
print(photo.videoThumbnail!)
print(photo.voiceNoteUrl!)
}
}
Saving also works fine:
func savePhoto() {
let dataStore = backendless.data.of(Photo.ofClass())
let newPhoto = Photo()
newPhoto.title = "TEST PHOTO"
newPhoto.imageUrl = "NEW PHOTO IMAGE URL"
newPhoto.username = "NEW PHOTO USER NAME"
newPhoto.datetime = Date()
newPhoto.address = "NEW PHOTO ADDRESS"
let savedPhoto = dataStore?.save(newPhoto) as! Photo
let currentUser = backendless.userService.login("test@test.com", password: "111")!
let userRelation = dataStore?.setRelation("user", parentObjectId: savedPhoto.objectId, childObjects: [currentUser.objectId])
let geoPoint = GeoPoint.geoPoint(GEO_POINT(latitude:0.00, longitude: 0.00)) as! GeoPoint
let savedGeopoint = backendless.geoService.save(geoPoint)!
let geoRelation = dataStore?.setRelation("location", parentObjectId: savedPhoto.objectId, childObjects: [savedGeopoint.objectId])
print("Photo saved")
}
Screenshots 2, 3, 4 is what we’ve got after insert.
You can find a new record in you Photos table, a test user in the Users table and a new geoPoint with (0;0) coordinates.
Please create a dedicated issue for the new problem and include a detailed description, e.g. the error text and a minimal example which could reproduce it.