diff --git a/Sources/SegmentFirebase/FirebaseDestination.swift b/Sources/SegmentFirebase/FirebaseDestination.swift index 0c22798..2740d1b 100644 --- a/Sources/SegmentFirebase/FirebaseDestination.swift +++ b/Sources/SegmentFirebase/FirebaseDestination.swift @@ -204,6 +204,10 @@ extension FirebaseDestination { func mapToStrings(_ mapDictionary: [String: Any?], finalize: (String, String) -> Void) { for (key, data) in mapDictionary { + + // Since dictionary values can be Optional we have to unwrap them + // before encoding so that we don't encode them as "Optional(*)" + // Note: nil values are NOT encoded. if let d = data { var dataString = d as? String ?? "\(d)" let keyString = key.replacingOccurrences(of: " ", with: "_")