Skip to content

Commit a1b4b62

Browse files
committed
Return default style for unsupported iOs Basemaps
1 parent bd4e3b7 commit a1b4b62

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

arcgis_map_ios/ios/Classes/ArcgisMapView.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,15 @@ class ArcgisMapView: NSObject, FlutterPlatformView {
260260
// don't set "isMagnifierEnabled" since we don't want to use this feature
261261
}
262262

263-
private func parseBaseMapStyle(_ string: String) -> AGSBasemapStyle {
264-
AGSBasemapStyle.allCases.first { enumValue in
265-
enumValue.getJsonValue() == string
266-
}!
263+
private func parseBaseMapStyle(_ string: String) -> AGSBasemapStyle {
264+
let baseMapStyle = AGSBasemapStyle.allCases.first { enumValue in
265+
enumValue.getJsonValue() == string
267266
}
267+
if baseMapStyle == nil {
268+
NSLog("Warning: Could not find a base map style matching the input string. Defaulting to .arcGISImageryStandard.")
269+
}
270+
return baseMapStyle ?? .arcGISImageryStandard
271+
}
268272

269273
/**
270274
* Convert map scale to zoom level

0 commit comments

Comments
 (0)