I've been able to get the G Maps iOS SDK with the Default Style working fine. But I wasn't a big fan of all the Buisness Labels showing so I decided to use the Map Styler to remove some of the Labels and went with the Silver look. I had Pasted the JSON into a TextEdit file and named it style.json . I added the code that was needed for the JSON into the the ViewController. When I Build the App on a iOS Device I get an Error in the console saying:
*One or more of the map styles failed to load. Error Domain=NSCocoaErrorDomain Code=3840 "No string key for value in object around character 1." UserInfo={NSDebugDescription=No string key for value in object around character 1.} and the Silver Style does not apply.
ViewController.swift - Style Code
do {
// Set the map style by passing the URL of the local file.
if let styleURL = Bundle.main.url(forResource: "style", withExtension: "json") {
mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)
} else {
NSLog("Unable to find style.json")
}
} catch {
NSLog("One or more of the map styles failed to load. \(error)")
}
Does anyone know what I'm doing wrong?
I resolved the issue by going into the Style.json file and removing all of the clutter in the top (was probably created when converting to .json) and now the style(s) works just fine.