I'm trying to merge room with WorldMap: but my screen goes black when doing a scan, First: i load world map
arWorldTrackingConfig.initialWorldMap = worldMap
//arWorldTrackingConfig.planeDetection = [.horizontal, .vertical]
arSession.run(arWorldTrackingConfig)
if #available(iOS 17.0, *) {
roomCaptureView = RoomCaptureView(frame: view.bounds, arSession: arSession)
}
else{
roomCaptureView = RoomCaptureView(frame: view.bounds)
}
roomCaptureView = RoomCaptureView(frame: view.bounds)
roomCaptureView.captureSession.delegate = self
roomCaptureView.delegate = self
view.insertSubview(roomCaptureView, at: 0)
and save when scan done:
roomCaptureView?.captureSession.arSession.getCurrentWorldMap { worldMapData, error in
if let error = error {
return
}
if let worldMap = worldMapData {
let fileURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("worldMapData")
do {
let data = try NSKeyedArchiver.archivedData(withRootObject: worldMap, requiringSecureCoding: true)
try data.write(to: fileURL)
} catch {
print("error ARWorldMap: \(error.localizedDescription)")
}
}
}
the first scan is fine, but the next time, when the worldMap is saved and loaded, my screen goes black, does anyone have a solution or sample code?? -thank-