Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue Google maps API on iOS 11 with Xcode 9

I'm trying to set a map in a view in my app and I got this problem:

CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo' CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo' CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/35C61A40-48B9-40E0-A6F9-AB7492A15009/simply-convertor.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'

I add an empty view to my ViewContoroller and change it's type to GMSMapView. And in viewDidLoad method I create a new map from location and init my main mapView:

override func viewDidLoad() {
        super.viewDidLoad()
        placesClient = GMSPlacesClient.shared()
        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyBest
        locationManager.requestWhenInUseAuthorization()
        locationManager.startMonitoringSignificantLocationChanges()

        locationAuthStatus()
        print(location.coordinate.latitude, location.coordinate.longitude)
        let camera = GMSCameraPosition.camera(withLatitude: 31.9650070083707, longitude: 34.7899029677496, zoom: 6.0)
        let map = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
        self.mapView = map

        // Creates a marker in the center of the map.
        let marker = GMSMarker()
        marker.position = CLLocationCoordinate2D(latitude: 31.9650070083707, longitude: 34.7899029677496)
        marker.title = "Home"
        marker.snippet = "Home"
        marker.map = mapView
    }

what is the problem?

like image 552
Omri Shapira Avatar asked Oct 08 '17 17:10

Omri Shapira


People also ask

What is MapKit in iOS?

MapKit is a powerful API available on iOS devices that makes it easy to display maps, mark locations, enhance with custom data and even draw routes or other shapes on top.

How do I add a map to Xcode?

Add Maps Capability to Your ProjectOpen your project with Xcode. In the Project navigator, select your project. Choose the target for the app in the Targets section of the outline view. Click the Signing & Capabilities tab in the project editor.

Is Google Maps iOS SDK free?

The Maps SDK for iOS uses a pay-as-you-go pricing model.


1 Answers

I find my problem.. it appears I misunderstood the initialliztion of a GMSMapView and not initialize it correct..

From other post the CoreData error that I mention is a problem of Google's API and it doesn't affect the app.

like image 114
Omri Shapira Avatar answered Oct 08 '22 14:10

Omri Shapira