Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking user Id and installation Id in Parse iOS

In the Data Browser pane of my Parse dashboard, I see Installation and User classes. However, for a specific user on a specific device, the objectIds don't match. Now, the channels a user has subscribed to is only visible in the installation class. Is there any way of linking the user id (from user class) to the installation id so that it is possible to know which channels a user has subscribed to? Any link to a tutorial or a solution would be appreciated.

like image 227
user2672886 Avatar asked Dec 09 '22 06:12

user2672886


2 Answers

// Associate the device with a user
PFInstallation *installation = [PFInstallation currentInstallation];
installation[@"user"] = [PFUser currentUser];
[installation saveInBackground];

This will put the user in a column "user" in the Installation table, the column would be a pointer to the _User table.

like image 88
Jacob Avatar answered Dec 18 '22 01:12

Jacob


Swift 2.1 Variant

let installation: PFInstallation = PFInstallation.currentInstallation()
installation["user"] = PFUser.currentUser()
installation.saveInBackground()   
like image 40
wm.p1us Avatar answered Dec 18 '22 02:12

wm.p1us