Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

undefined is not an object #52

Open
erikparr opened this issue Feb 8, 2018 · 7 comments
Open

undefined is not an object #52

erikparr opened this issue Feb 8, 2018 · 7 comments

Comments

@erikparr
Copy link

erikparr commented Feb 8, 2018

Hi - Very nice project here. I'm exploring your examples and I keep getting the following error on plane finder example. I am on WebARonARKit, ios 11.2.5 three.js .89, and three.ar.js 1.7
img_0038

@judax
Copy link
Contributor

judax commented Feb 8, 2018

Thank you for reaching out and pointing this problem out. Are you able to consistently reproduce the issue?

@erikparr
Copy link
Author

erikparr commented Feb 9, 2018

Yes - consistent every time showPlanes is enabled for THREE.ARDebug. When showPlanes is false the error disappears.

@ITJesse
Copy link

ITJesse commented Mar 12, 2018

I can confirm this error.
It happens every new suface be found after reload the page in the WKWebView.

I have a workaround, hope it helps.
ITJesse@833a90d

@lincolnfrog
Copy link
Contributor

Thanks, @ITJesse - I left a comment on your fix. This is a deeper problem as basically we are getting the events out-of-order, which can result in all kinds of badness like recreating deleted planes if we get an update after a delete. The correct fix is to handle the events on the native side where they come in the correct order and then send a batch add/update/remove event to JS along with each frame update so it can't come in out-of-order on the JS side.

@lincolnfrog
Copy link
Contributor

@ITJesse I left another comment - would like to get a band-aid in there but I think the best fix is to change onPlaneUpdated_, where the crash happens, to just ignore the update if the plane doesn't exist. That will prevent us from leaking planes if the update/delete come in reverse order. Do you want to make that fix?

@ITJesse
Copy link

ITJesse commented Mar 13, 2018

I will try it later.
Thanks.

@ITJesse
Copy link

ITJesse commented Mar 16, 2018

@lincolnfrog I have done some research these days. And I found that it maybe caused by a "dummy restart" of ARSession. See here.

All of the planes had found is still left in the native side. This will cause the data to be out of sync between native and WKWebkit side after a web page reload happened (maybe out-of-memory, refresh, and so on).

So when we found a plane again, the native will fire a onPlaneUpdate event instead of a onPlaneAdded event which we expect.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants