I'm using Parse for backend and I'm designing the Activity class. Activity class has 4 columns. fromUser(that would be PFUser currentUser), activityType(String: lets say it's "like"), argument("Post" pointer associated witht that like) and toUser(that would be the owner of the post.) What I'm troubling is that when I try to save the fromUser column i have the error
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'User cannot be saved unless they have been authenticated via logIn or signUp'
How can I save a activity object properly? I can log my own activities(since both the fromUser and toUser is already me). But Parse doesnt lets me to log activities that relates to other Users(in the case that i'm trying to like someone elses post.)
sample code here:
//user objectId: the object id of the User who posted the Post.
PFUser *postOwner = [PFUser objectWithoutDataWithObjectId:self.userObjectId];
[postOwner setObjectId:self.userObjectId];
activity[@"fromUser"]=[PFUser currentUser];
activity[@"toUser"]= postOwner;
activity[@"post"]=postPointer;
I'm having the error in the "toUser" line.