4

A have an iOS app where a user (anonymous at first, as I am using enableAutomaticUser) calls signUpInBackgroundWithBlock which returns succeeded = YES. The new, now non-anonymous user creates an object and afterSave() is called in cloud code.

If I inspect request.user in afterSave() it shows that user is NULL, but the object is saved without error and its createdBy is also set correctly to the new user.

According to the docs, request.user should only be NULL if the user is not logged in. Does anyone have any idea why it would be NULL following a successful signup? Is this a bug?

Albert Renshaw
  • 17,282
  • 18
  • 107
  • 195
blushmessenger
  • 316
  • 3
  • 5

2 Answers2

1

This can happen ,if you are re-initialising request.user after your login procedure, Make sure that, you use the same instance throughout the app

Geet
  • 2,427
  • 2
  • 21
  • 39
-2

request.object

In the afterSave for a PFUser save that will give you your User object you can use in that hook.

zumzum
  • 17,984
  • 26
  • 111
  • 172