This problem is solved.
In the previous implementation, cancelScanning() is called when isScanning is false
@IBAction func saveScanning(_ sender: UIBarButtonItem) {
if isScanning { saveSession() } else { cancelScanning(sender) }
self.exportButton?.isEnabled = false
self.activityIndicator?.startAnimating()
}
The implementation of cancelScanning() dismiss the navigationController which cause the problem of initiating a new instance of the RoomCaptureViewController class when starting the next scanning session
@IBAction func cancelScanning(_ sender: UIBarButtonItem) {
navigationController?.dismiss(animated: true)
}
Solution:
Just call startSession() to start the next capture session with the same ARSession.
@IBAction func saveScanning(_ sender: UIBarButtonItem) {
if isScanning { saveSession() } else { startSession() }
self.exportButton?.isEnabled = false
self.activityIndicator?.startAnimating()
}
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: