Skip to content

App Crashes when app is put into background or notifications are opened after AR Scene is left #399

@jamessappy

Description

@jamessappy

Environment

  • Expo SDK: 52.0.47
  • React Native: 0.76.9
  • React: 18.3.1
  • @reactvision/react-viro: 2.43.3
  • Platform: iOS (physical device)
  • Build type: Custom Expo Dev Client && Release Build

Description

When navigating away from a screen with a ViroARSceneNavigator, the app crashes on iOS.
Xcode shows:

-[VROViewAR applicationWillResignActive:]: unrecognized selector sent to deallocated instance

Looks like the AR view is deallocated before the lifecycle observer is removed.

Steps to Reproduce

Open a screen with ViroARSceneNavigator

Let AR start

Navigate away (navigation.replace or goBack)

Swipe down from top of screen to bring up notifications or attempt to slide the app into background.

App crashes with the log above

Notes

Tried manual cleanup with:

arNavRef.current?.pause?.();
arNavRef.current?.exitViro?.();
arNavRef.current?.unloadScene?.();

Still crashes

✅ Happens every time when leaving an AR scene.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions