Hello,
I used to be able to encode CapturedRoomData using JSONEncoder with the code below:
// Encode CapturedRoomData
func encodeRoomData(_ roomData: CapturedRoomData) -> Data? {
print("#ECRD1 - Data: \(roomData)")
do {
let encodedRoom = try JSONEncoder().encode(roomData)
print("#ECRD2 - Encoded: \(encodedRoom.description)")
return encodedRoom
} catch {
print("#ECRD3 - Failed with error: \(error)")
}
return nil
}
A few weeks ago I noticed this approach is no longer working. The encoding fails and I get the following error printed:
#ECRD3 - Failed with error: invalidValue(RoomPlan.CapturedRoomData, Swift.EncodingError.Context(codingPath: [], debugDescription: "Invalid data", underlyingError: nil))
Can anyone help me find the root of this problem?
For reference, here’s what the printed CapturedRoomData looks like (with the keyframes omitted):
#ECRD1 - Data: CapturedRoomData(keyframes: [...], coreAsset: <RSAsset: 0x283988bd0>, arFrameReferenceOriginTransform: simd_float4x4([[0.9995456, 0.0, 0.030147359, 0.0], [0.0, 1.0, 0.0, 0.0], [-0.030147359, 0.0, 0.9995456, 0.0], [0.38664898, 0.93699455, 0.38685757, 1.0]]))