Pause ARSession broken in 17.4

I have a tracking issung with the latest beta 17.4 and want to know if anyone encountered the same problem.

My app is using the pause=false functionality for multiroom that apple provided to let the ARSession run in the background:

    roomCaptureView?.captureSession.stop(pauseARSession: false)

When resuming the scan/scanning the next room I initialize a new RoomCaptureView with the running ARSession:

        let roomCaptureView = RoomCaptureView(frame: rcvc.view.bounds, arSession: arSession!)

This worked fine on all previous versions and different devices. Since the update to 17.4 I noticed that the tracking will be lost after initializing the next scan which feels like the pauseARSession is not working (the ARSession has still the same ID)

Devices: This behaviour/error does not occur on devices with 17.3 or lower: 15 Pro Max, 14 Pro Max, 13 Pro This behaviour/error occures on devices with 17.4: 15 Pro Max, 14 Pro Max

If anyone has noticed the same issue I would like to know that I'm not the only one. Thanks.

Answered by JohnnyBanana in 781207022

Ok it seems like the issue was caused by the RoomCaptureView. I called roomCaptureView?.removeFromSuperview() after every finished room and when starting the next room I added it again to the view controller with roomCaptureViewConrtoller.view.insertSubview(roomCaptureView, at: 0).

It seems like this was not an issue in versions < iOS 17.4 beta but apparently you have to keep the view attached to the view controller and the multiroom works as in previous versions.

I am seeing something similar and other strangeness. After running for a while I am seeing a multitude of AR Sessions populating my Self stack and don't know from where they are coming! I put a breakpoint in the SessionwasInterrupted code in my delegate and I had 3 new AR Sessions show up in the Self stack in various objects for Thread 1 and one matched an entry for the stack object arSession . I took down the pointers to the stack and took screenshots of the memory layout in the frames of self. So then I went on and let it finish the SessionWasInterrupted only to have it jump into another with a whole NEW set of ARSession carcasses lying around in the Self Stack frame that was active and only one of them matched the arSession again and Was not the same as the previous one.

I have seen this and other strangeness in the handling of ARSessions

Accepted Answer

Ok it seems like the issue was caused by the RoomCaptureView. I called roomCaptureView?.removeFromSuperview() after every finished room and when starting the next room I added it again to the view controller with roomCaptureViewConrtoller.view.insertSubview(roomCaptureView, at: 0).

It seems like this was not an issue in versions < iOS 17.4 beta but apparently you have to keep the view attached to the view controller and the multiroom works as in previous versions.

Pause ARSession broken in 17.4
 
 
Q