Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PFInstallation currentInstallation]'s objectId is nil #1568

Open
bmueller opened this issue Oct 29, 2020 · 8 comments
Open

[PFInstallation currentInstallation]'s objectId is nil #1568

bmueller opened this issue Oct 29, 2020 · 8 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@bmueller
Copy link

In the past few weeks, I've had multiple users reporting problems with my app related to the Parse SDK. After some troubleshooting, it looks like the issue is that the objectId on their [PFInstallation currentInstallation] is nil.

I've never seen this happen before and have been using the Parse SDK for years now. What could be causing this? Is there a way to force the currentInstallation to get a new objectId? I tried saving the installation and calling [PFInstallation getCurrentInstallationInBackground], but neither of those created a new objectId.

I'm running the latest version of the Parse iOS SDK - not sure if there were any recent changes that could be causing this.

@cbaker6
Copy link
Contributor

cbaker6 commented Nov 9, 2020

Do you ever specifically call PFInstallation.current()?.saveInBackground() after the user is logged in? If not, your Installation table is never populated to Parse as it doesn't save by default. You can check your Installation table in Parse Dashboard to see if new entries are there. If there are non or there's no Installation table at all, any find on PFInstallation will return nothing as there is nothing to be queried.

The PFInstallation is however created locally on a users device when they login, but it will never have an objectId unless you use PFInstallation.current()?.saveInBackground().

@bmueller
Copy link
Author

bmueller commented Nov 9, 2020

Yes, I specifically had the user who was experiencing this issue run a command that called [[PFInstallation currentInstallation] saveInBackground]. Still no objectId. Note that this is only happening for a small handful of users - I have hundreds of thousands of other users where this is working just fine.

@cbaker6
Copy link
Contributor

cbaker6 commented Nov 9, 2020

I wonder if the save was successful or returned an error. Do you see their installation in Installation table on Parse Dashboard?

@bmueller
Copy link
Author

bmueller commented Nov 9, 2020

The saveInBackground block does say that it was successful (despite there still not being an objectId), but I'm not sure how I'd find their installation in the Installation table - there's 100k+ records in there.

@bmueller
Copy link
Author

bmueller commented Dec 1, 2020

@cbaker6 to follow up on this, it looks like the data is being saved to Parse correctly and the object on Parse does have an objectId. The Parse SDK on-device is just returning null for the objectId on the currentInstallation.

@cbaker6
Copy link
Contributor

cbaker6 commented Dec 19, 2020

@bmueller Can you try to always dispatch to the main when saving the Installation as it uses some UIApplication (badges) which requires the main queue. This can be the reason for the sporadic behavior. Let me know if you have any luck with this.

@bmueller
Copy link
Author

I'll give that a try!

@jesusmateos1234
Copy link

Same issue

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

4 participants