Reputation: 14070
When I get support requests from users of my iOS app, it helps immensely to be able to see their data locally in the iOS Simulator.
I want to be able to pull in a specific user's Parse data from within my dev environment (Xcode + Simulator) so I can debug things.
Is there a way to set the current PFUser to be a certain user? I wouldn't ever ship my app with this code, I just want to be able to use it on my dev machine.
Thanks!
Upvotes: 1
Views: 110
Reputation: 9912
Yes you can, use the becomeInBackground:
method of the PFUser
class and pass in the session token of the user you want to 'login as'. The session token should be automatically stored in the User
object.
To get the sessionToken of a user, make a request to https://api.parse.com/1/users/{objectId}
and use the master key instead of the REST-API key. This will return the user object and the sessionToken (if there user is logged in)
https://www.parse.com/docs/ios_guide#users-become/iOS
Upvotes: 1