Upload A relation from custom class

I got the objectId of status , but when i do this it never upload the relation ?


let activity = Activity()
 activity.fromUser = backendless.userService.currentUser
 activity.toUser = userId as! BackendlessUser
 activity.type = "likes"
 activity.status.objectId = self.loadLikes[sender.tag].3

That code does not perform any save or update operations with the server.









  let activityStore = backendless.data.of(Activity.ofClass())

                    

                    activityStore.save(

                        activity,

                        response: { (result: AnyObject!) -> Void in

                            print("Follow Have Been Successfully Uploaded(Activity Class) --- StatusUpload (UIViewController)")

                            

                        },

                        error: { (fault: Fault!) -> Void in

                            print("fServer reported an error: \(fault)")

                    })        // save object asynchronously

                    

Sorry, but the information you provided does not help. For example:

    It is not clear what object id is being assigned to activity.status it is not clear from the screenshots what tables they show (why do you crop the screenshots anyway? it makes it harder to understand what you're showing)
Mark
    Activity.status is relation to Status class screenshot seems cannot delete i got the status class objectId but when i do the above code it seems like there is nothing being uploaded .

Please upload full screenshots and also provide specific value of objectId which you assign to activity.status.objectId

thanks for the help it seems like i cant direct upload the objectId which is in relation

so i use

let status = Status()
status.objectId = self.loadLikes[sender.tag].3
activity.status = status

if you check status.objectId, what number/letters do you see in there? (use debugger to get the answer)

58609DFE-2CCA-EFF5-FFDE-2128F0B42000

i check the documentation again it seems like using class can only upload the relation of and object

Thanks. Now please post screenshots of the “status” and “activity” tables

I have solved this haha using it seems like this is the correct way of doing it

let status = Status()
status.objectId = self.loadLikes[sender.tag].3
activity.status = status

Glad you got it working. I still do not understand how it is different than the code you posted earlier:

http://support.backendless.com/t/upload-a-relation-from-custom-class#comment-9679

relation seems like cannot be upload direct through objectId , self.loadLIkes[sender.tag].3 is and objectId String so , i uses var assign it to Status Class and set it objectId then assign it to activity.status . It seems like it is working this way haha

activity.status.objectId = self.loadLikes[sender.tag].3 

It seems like not working == i check my database it created a new row

…created a new row in what table?

This is my class as you can see . I just wanna upload a relation from activity.status which is an existing status object in status class. As you can see if i use

activity.status.objectId = self.loadLikes[sender.tag].3 // An object ID

the status relation object is nil in the database table

And this my database class am i doing it correct ?









class Activity : NSObject {

    

    var fromUser : BackendlessUser?

    var toUser : BackendlessUser?

    var status : Status?

    var type : String?

    var objectId : String?

    var created : NSDate?

    var updated : NSDate?

    var ownerId : String?

}

class Status : NSObject {

    var objectId : String?

    var ownerId : String?

    var status : String?

    var user : BackendlessUser?

    var created : NSDate?




}

It is going to be VERY hard to provide support to you if you do not answer my questions. You wrote:

i check my database it created a new row

Then I asked you:

created a new row in what table?

And you do not answer that question.

sorry my bad, i am very bad at expressing . If i am using this it will create a new row which i dont want when it is saved .

let status = Status()
status.objectId = self.loadLikes[sender.tag].3
activity.status = status

Create new row in which table? Status or Activity???