瀏覽代碼

fix:处理地图的锚点参数为空的情况。

“HeShaoZe” 4 月之前
父節點
當前提交
c472aab879
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      plugins/map_mapkit_ios/ios/Classes/MapView/Model/Models.swift

+ 6 - 1
plugins/map_mapkit_ios/ios/Classes/MapView/Model/Models.swift

@@ -152,7 +152,12 @@ class ATMapMarker: NSObject, Codable {
         markerType = MarkerTypeFactory.markerType(from: rawValue)
         
         ///气泡内容
-        tags = try container.decode([String : String].self, forKey: .tags)
+        // 处理tags为空的情况
+         if container.contains(.tags) {
+             tags = try container.decodeIfPresent([String: String].self, forKey: .tags) ?? [:]
+         } else {
+             tags = [:] // 默认为空字典
+         }
     }
 
     func encode(to encoder: Encoder) throws {