user3431429
user3431429

Reputation: 111

Cannot apply style to GMSMapView

My code is as below:

    /* Map */
    mapView = GMSMapView()
    mapView.delegate = self
    mapView.mapType = .normal        
    do {
        // Set the map style by passing the URL of the local file.
        if let styleURL = Bundle.main.url(forResource: "styles", withExtension: "json") {
            mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)
        } else {
            NSLog("Unable to find styles.json")
        }
    } catch {
        NSLog("One or more of the map styles failed to load. \(error)")
    }

I am following this tutorial on how to customize my Google map.

Above is my code for implementing the styles.json file. I added the file in my build bundle, and the code never throws an exception regarding not being able to parse my json file. It simply does not apply the style effects onto my map.

Any help would be appreciated. I am slowly dying inside!!!

Upvotes: 4

Views: 497

Answers (1)

user3431429
user3431429

Reputation: 111

Leaving an answer for anyone in the future that goes down my path:

Google map styling does not work for maps of South Korea. It even works in North Korea, but not South. South Korea's law prohibits map data from being exported to foreign datacenters.

source:

Yes , Korea does not support some features offered by Google Map due to national law. Google Map Korea can not be export map data for data centers abroad or including the ability to dynamically change the map image. Many South Korea Maps and services are limited to the domestic uses and Google is striving to make this a better service. For more details here's the original answer in Korean: original reply from Google Maps Korea

Upvotes: 2

Related Questions