Closed RobinopdeBeek closed 3 years ago
I've pinpointed where the issue occurs and it happens when callling change.ChangeType
.
I ran this code in the listener callback code:
foreach (DocumentChange change in snapshot.GetChanges())
{
Debug.Log("change.ToString()" + change.ToString());
Debug.Log("change.Document.Id" + change.Document.Id);
Debug.Log("change.NewIndex" + change.NewIndex);
Debug.Log("DocumentChange.Type.Added: " + DocumentChange.Type.Added);
Debug.Log("change.ChangeType" + change.ChangeType);
}
Reading .Document.ID or .NewIndex work fine, but when trying to read .ChangeType the crash happens.
Any ideas for a solution or work around maybe?
Found the work around on the forums! https://github.com/firebase/quickstart-unity/issues/889#issuecomment-745695182
public DocumentChange.Type GetChangeType(DocumentChange change) {
if (change.OldIndex < 0) {
return DocumentChange.Type.Added;
} else if (change.NewIndex < 0) {
return DocumentChange.Type.Removed;
} else {
return DocumentChange.Type.Modified;
}
}
Thanks @wilhuff !
[REQUIRED] Please fill in the following fields:
[REQUIRED] Please describe the issue here:
I am not sure how to reproduce this issue. I am mostly looking for insights into what could cause this issue. Sorry if this is the wrong place to ask this. Patrick Martin suggested I ask my question here again.
My Unity app uses Firebase Firestore listeners to receive data. In the Unity editor everything works very well and I never get an error. I built to my Android device (Pixel 2), but there it crashes about a second after startup.
I looked at Android Logcat and noticed that the last thing it did was receive a callback from Firestore:
After that the fatal error(s) happens:
And that goes on for another 2700 lines... If you need a different section just let me know
Steps to reproduce:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? No, this is from my project that I've been working on for quite some time. Hopefully someone can give some insights into what could cause this issue first, but if you guys really need a sample project I'll spend some time on making it :)
Relevant Code:
The code that handles initialization:
The code that registers the Firestore listener and callback:
My thoughts so far
The code reaches
Debug.Log("Finished creating Project ScriptableObject with title: " + project.data.Title);
. So the documents are well received. After that I handle the DocumentChanges, where the errorJNI DETECTED ERROR IN APPLICATION: mid == null
is raised. Does that mean the QuerySnapshot or DocumentChange no longer exist? I tried storing both the QuerySnapshot and DocumentChange as static variables, but that didn't help.Thanks for any assistance!