A case occured where the Structure Builder is crashing with EXC_BAD_ACCESS and the error cannot be handled without the app crashing.
I have two minimalistic models, one even reduced to the minimum of the "coreModel" itself. (See attachment)
Each model alone in the StructureBuilder works fine.
Using both causes the crash.
Has anyone found a way to handle this error without the app crashing?
override func viewDidLoad() {
super.viewDidLoad()
let capturedRooms: [CapturedRoom] = [
loadCapturedRoom(fileName: "appleModel1"),
loadCapturedRoom(fileName: "appleModel2")
]
buildStructure(capturedRooms)
}
func buildStructure(_ capturedRooms: [CapturedRoom]) {
let structureBuilder = StructureBuilder(options: [])
Task {
print("----- START BUILDING STRUCTURE -----")
do {
let capturedStructure = try await structureBuilder.capturedStructure(from: capturedRooms)
} catch {
print("----- FAILED BUILDING STRUCTURE -----")
}
// Crashing with: EXC_BAD_ACCESS
// This part will never be reached
print("----- FINISH BUILDING STRUCTURE -----")
}
}
func loadCapturedRoom(fileName: String) -> CapturedRoom {
do {
guard let jsonFileURL = Bundle.main.url(forResource: fileName, withExtension: "json") else {
fatalError("JSON file not found.")
}
let data = try Data(contentsOf: jsonFileURL)
return try JSONDecoder().decode(CapturedRoom.self, from: data)
} catch {
fatalError(error.localizedDescription)
}
}
appleModel1.json
appleModel2.json
2
2
2.1k