I've saved my RoomPlan.CapturedRoom
in CoreData
as a Data
object. When I open it again on a device WITH a LiDAR Scanner, it works totally fine. However, when I try to open it on the simulator for example, I get an error saying "RoomPlan.CapturedRoom.Error.deviceNotSupported".
The code I use to convert the Data
back to a CapturedRoom
is this:
let decoder = JSONDecoder()
do {
self.capturedRoom = try decoder.decode(CapturedRoom.self, from: capturedRoomData)
} catch {
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
The fatalError is thrown here giving me the error above.
The solution posted by @Darkwonder is the right approach to this: "You can write your own class and map it to Apples CapturedRoom, and implement Codable. Another solution is to export the CapturedRoom to JSON."