IOS: Error with Google Maps, it does not load the map but the bookmarks


Google Maps does not load the map on iphone, but when I connect the iphone to the xcode and execute the project, if it loads the map correctly.

This is the code:

let camera = -33.868, longitude: 151.2086, zoom: 14)
let mapViewtest = .zero, camera: camera)

let marker = GMSMarker()
marker.position =
marker.snippet = "Hello World"
//marker.appearAnimation = kGMSMarkerAnimationPop = mapViewtest

view = mapViewtest

The console shows me this, but I do not know if it has anything to do


CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/33FC89CC-DC52-4212-A361-F54DD2AC3CD9/'

When I connect the iphone to the xcode and execute the application, the correct map appears:

When I run the app on the iphone without connecting it to the xcode the map does not load:

asked by Alberto Mier 09.03.2018 в 17:23

2 answers


In this case you are using Google maps and not iOS , you must first ensure create a Key API but add a restriction if you use the SDK for iOS :

The above seems to be correct because although your map can not be seen but the marker unfolds without problem, I suggest you call layoutIfNeeded () :


layoutIfNeeded () Use this method to force the view   to update your design immediately. When using Auto Design, the   Design engine updates the position of views according to   necessary to meet the changes in the restrictions. Using the   view that receives the message as the root view, this method establishes   the view subtree that starts at the root. If there is not   pending disposition updates, this method closes without   modify the design or call any callbacks   related to the design.

This can solve the problem.

Now with regard to the message you are commenting on, I do not think it influences the display of the map:


CoreData: annotation: Failed to load optimized model at path   '/var/containers/Bundle/Application/33FC89CC-DC52-4212-A361-F54DD2AC3CD9/'

Probably your project was created with another version of Core Data when changing to a version of Xcode more recent indicates that it can not load the file that stores the .mom data model at the same time a .omo is generated

You can generate a new version of the data model and compile with the version of Xcode that you are using.


answered by 14.03.2018 в 01:07

I pass the block of an example that I have that works without problems.

     private func crearMapa(){
    let barHeight: CGFloat = UIApplication.shared.statusBarFrame.size.height
    let displayWidth: CGFloat = self.view.frame.width
    let displayHeight: CGFloat = self.view.frame.height

    let camera = CLLocationDegrees(self.coordenadas.latitud)! , longitude: CLLocationDegrees(self.coordenadas.longitud)!, zoom: 15.0)

    //let camera =  19.454166, longitude: -99.112110, zoom: 6.0)

    let mapView = CGRect(x: 0, y: barHeight + 100, width: displayWidth, height: displayHeight - barHeight), camera: camera)
    mapView.isMyLocationEnabled = true
    //view = mapView

    // Creates a marker in the center of the map.
    let marker = GMSMarker()

    marker.position = CLLocationCoordinate2D(latitude: CLLocationDegrees(self.coordenadas.latitud)!, longitude: CLLocationDegrees(self.coordenadas.longitud)!)

    marker.title = "Sydney"
    marker.snippet = "Australia" = mapView


You provide very little code, I do not know what function you call the creation of the map, it does not matter much but it could be something meaningless the problem.

Have you tried this?

answered by 24.04.2018 в 00:41