Google Maps not showing/loading ios












1















I started working with google maps ,first it was showing map but after its showing nothing and my log showing this



CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo
CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'
CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'



Things i tried



I have restricted bundle id in api console .
I also tried removing StorageWithTileProto.omo file.
I cleaned project several times.
I restarted phone several times.
I also created new project ,that show same error .



This is my code



import Foundation
import UIKit
import GoogleMaps

class GoogleMaps :UIViewController {

var gsmMapView: GMSMapView!



@IBOutlet weak var mapView: UIView!

let loacationManager = CLLocationManager()

override func viewDidLoad() {

navigationController?.navigationBar.barTintColor =
UIColor.hexStringToUIColor(hex: "#555555")

loacationManager.delegate = self

loacationManager.requestAlwaysAuthorization()




// Zoom to location
let camera = GMSCameraPosition.camera(withLatitude: 0,
longitude: 0, zoom: 6.0)
// get google Maps
gsmMapView = GMSMapView.map(withFrame: CGRect.zero, camera:
camera)
mapView.addSubview(gsmMapView)

}

func toast(message msg: String)
{self.navigationController?.view.makeToast(message: msg)}
}


extension GoogleMaps : CLLocationManagerDelegate{

func locationManager(_ manager: CLLocationManager,
didChangeAuthorization status: CLAuthorizationStatus) {

print("status (status.rawValue)")
if(status != CLAuthorizationStatus.authorizedAlways){

permissionDialog()
return
}
loacationManager.startUpdatingLocation()





}

func locationManager(_ manager: CLLocationManager, didUpdateLocations
locations: [CLLocation]) {

toast(message: "didUpdateLocations")
guard let location = locations.first else {
return
}

// 7
// gsmMapView.camera = GMSCameraPosition(target:
location.coordinate,
// zoom: 15, bearing: 0, viewingAngle: 0)
//
// 8
loacationManager.stopUpdatingLocation()
}

func locationManager(_ manager: CLLocationManager,
monitoringDidFailFor region: CLRegion?, withError error: Error) {
print("Monitoring failed for region with identifier: .
(region!.identifier)")
}

func locationManager(_ manager: CLLocationManager, didFailWithError
error: Error) {
print("Location Manager failed with the following error: .
(error)")
}


func permissionDialog() {
self.toast(message: "Give Always Authorization Premission")

let alertController = UIAlertController(title: "Permission",
message: "Please go to
Settings and turn on the location alway permissions
for to work",
preferredStyle: .alert)
let settingsAction = UIAlertAction (title: "Settings", style:
.default, handler: ({ (_) -> Void in

guard let settingsUrl = URL(string:
UIApplication.openSettingsURLString) else {
return}
if(UIApplication.shared.canOpenURL(settingsUrl)){
UIApplication.shared.open(settingsUrl, options: [:], completionHandler: { (success) in })

}
}))
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel,
handler: nil)

alertController.addAction(settingsAction)
alertController.addAction(cancelAction)
self.present(alertController, animated: true, completion: nil)
}


}



My swift version is 4.2 and build target version is 12.1 . Please let me know what i am d










share|improve this question



























    1















    I started working with google maps ,first it was showing map but after its showing nothing and my log showing this



    CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo
    CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'
    CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'



    Things i tried



    I have restricted bundle id in api console .
    I also tried removing StorageWithTileProto.omo file.
    I cleaned project several times.
    I restarted phone several times.
    I also created new project ,that show same error .



    This is my code



    import Foundation
    import UIKit
    import GoogleMaps

    class GoogleMaps :UIViewController {

    var gsmMapView: GMSMapView!



    @IBOutlet weak var mapView: UIView!

    let loacationManager = CLLocationManager()

    override func viewDidLoad() {

    navigationController?.navigationBar.barTintColor =
    UIColor.hexStringToUIColor(hex: "#555555")

    loacationManager.delegate = self

    loacationManager.requestAlwaysAuthorization()




    // Zoom to location
    let camera = GMSCameraPosition.camera(withLatitude: 0,
    longitude: 0, zoom: 6.0)
    // get google Maps
    gsmMapView = GMSMapView.map(withFrame: CGRect.zero, camera:
    camera)
    mapView.addSubview(gsmMapView)

    }

    func toast(message msg: String)
    {self.navigationController?.view.makeToast(message: msg)}
    }


    extension GoogleMaps : CLLocationManagerDelegate{

    func locationManager(_ manager: CLLocationManager,
    didChangeAuthorization status: CLAuthorizationStatus) {

    print("status (status.rawValue)")
    if(status != CLAuthorizationStatus.authorizedAlways){

    permissionDialog()
    return
    }
    loacationManager.startUpdatingLocation()





    }

    func locationManager(_ manager: CLLocationManager, didUpdateLocations
    locations: [CLLocation]) {

    toast(message: "didUpdateLocations")
    guard let location = locations.first else {
    return
    }

    // 7
    // gsmMapView.camera = GMSCameraPosition(target:
    location.coordinate,
    // zoom: 15, bearing: 0, viewingAngle: 0)
    //
    // 8
    loacationManager.stopUpdatingLocation()
    }

    func locationManager(_ manager: CLLocationManager,
    monitoringDidFailFor region: CLRegion?, withError error: Error) {
    print("Monitoring failed for region with identifier: .
    (region!.identifier)")
    }

    func locationManager(_ manager: CLLocationManager, didFailWithError
    error: Error) {
    print("Location Manager failed with the following error: .
    (error)")
    }


    func permissionDialog() {
    self.toast(message: "Give Always Authorization Premission")

    let alertController = UIAlertController(title: "Permission",
    message: "Please go to
    Settings and turn on the location alway permissions
    for to work",
    preferredStyle: .alert)
    let settingsAction = UIAlertAction (title: "Settings", style:
    .default, handler: ({ (_) -> Void in

    guard let settingsUrl = URL(string:
    UIApplication.openSettingsURLString) else {
    return}
    if(UIApplication.shared.canOpenURL(settingsUrl)){
    UIApplication.shared.open(settingsUrl, options: [:], completionHandler: { (success) in })

    }
    }))
    let cancelAction = UIAlertAction(title: "Cancel", style: .cancel,
    handler: nil)

    alertController.addAction(settingsAction)
    alertController.addAction(cancelAction)
    self.present(alertController, animated: true, completion: nil)
    }


    }



    My swift version is 4.2 and build target version is 12.1 . Please let me know what i am d










    share|improve this question

























      1












      1








      1








      I started working with google maps ,first it was showing map but after its showing nothing and my log showing this



      CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo
      CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'
      CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'



      Things i tried



      I have restricted bundle id in api console .
      I also tried removing StorageWithTileProto.omo file.
      I cleaned project several times.
      I restarted phone several times.
      I also created new project ,that show same error .



      This is my code



      import Foundation
      import UIKit
      import GoogleMaps

      class GoogleMaps :UIViewController {

      var gsmMapView: GMSMapView!



      @IBOutlet weak var mapView: UIView!

      let loacationManager = CLLocationManager()

      override func viewDidLoad() {

      navigationController?.navigationBar.barTintColor =
      UIColor.hexStringToUIColor(hex: "#555555")

      loacationManager.delegate = self

      loacationManager.requestAlwaysAuthorization()




      // Zoom to location
      let camera = GMSCameraPosition.camera(withLatitude: 0,
      longitude: 0, zoom: 6.0)
      // get google Maps
      gsmMapView = GMSMapView.map(withFrame: CGRect.zero, camera:
      camera)
      mapView.addSubview(gsmMapView)

      }

      func toast(message msg: String)
      {self.navigationController?.view.makeToast(message: msg)}
      }


      extension GoogleMaps : CLLocationManagerDelegate{

      func locationManager(_ manager: CLLocationManager,
      didChangeAuthorization status: CLAuthorizationStatus) {

      print("status (status.rawValue)")
      if(status != CLAuthorizationStatus.authorizedAlways){

      permissionDialog()
      return
      }
      loacationManager.startUpdatingLocation()





      }

      func locationManager(_ manager: CLLocationManager, didUpdateLocations
      locations: [CLLocation]) {

      toast(message: "didUpdateLocations")
      guard let location = locations.first else {
      return
      }

      // 7
      // gsmMapView.camera = GMSCameraPosition(target:
      location.coordinate,
      // zoom: 15, bearing: 0, viewingAngle: 0)
      //
      // 8
      loacationManager.stopUpdatingLocation()
      }

      func locationManager(_ manager: CLLocationManager,
      monitoringDidFailFor region: CLRegion?, withError error: Error) {
      print("Monitoring failed for region with identifier: .
      (region!.identifier)")
      }

      func locationManager(_ manager: CLLocationManager, didFailWithError
      error: Error) {
      print("Location Manager failed with the following error: .
      (error)")
      }


      func permissionDialog() {
      self.toast(message: "Give Always Authorization Premission")

      let alertController = UIAlertController(title: "Permission",
      message: "Please go to
      Settings and turn on the location alway permissions
      for to work",
      preferredStyle: .alert)
      let settingsAction = UIAlertAction (title: "Settings", style:
      .default, handler: ({ (_) -> Void in

      guard let settingsUrl = URL(string:
      UIApplication.openSettingsURLString) else {
      return}
      if(UIApplication.shared.canOpenURL(settingsUrl)){
      UIApplication.shared.open(settingsUrl, options: [:], completionHandler: { (success) in })

      }
      }))
      let cancelAction = UIAlertAction(title: "Cancel", style: .cancel,
      handler: nil)

      alertController.addAction(settingsAction)
      alertController.addAction(cancelAction)
      self.present(alertController, animated: true, completion: nil)
      }


      }



      My swift version is 4.2 and build target version is 12.1 . Please let me know what i am d










      share|improve this question














      I started working with google maps ,first it was showing map but after its showing nothing and my log showing this



      CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo
      CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'
      CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/EA2D4483-D98A-4D23-AFE4-ACDD86C0DF2A/Key Sensor.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'



      Things i tried



      I have restricted bundle id in api console .
      I also tried removing StorageWithTileProto.omo file.
      I cleaned project several times.
      I restarted phone several times.
      I also created new project ,that show same error .



      This is my code



      import Foundation
      import UIKit
      import GoogleMaps

      class GoogleMaps :UIViewController {

      var gsmMapView: GMSMapView!



      @IBOutlet weak var mapView: UIView!

      let loacationManager = CLLocationManager()

      override func viewDidLoad() {

      navigationController?.navigationBar.barTintColor =
      UIColor.hexStringToUIColor(hex: "#555555")

      loacationManager.delegate = self

      loacationManager.requestAlwaysAuthorization()




      // Zoom to location
      let camera = GMSCameraPosition.camera(withLatitude: 0,
      longitude: 0, zoom: 6.0)
      // get google Maps
      gsmMapView = GMSMapView.map(withFrame: CGRect.zero, camera:
      camera)
      mapView.addSubview(gsmMapView)

      }

      func toast(message msg: String)
      {self.navigationController?.view.makeToast(message: msg)}
      }


      extension GoogleMaps : CLLocationManagerDelegate{

      func locationManager(_ manager: CLLocationManager,
      didChangeAuthorization status: CLAuthorizationStatus) {

      print("status (status.rawValue)")
      if(status != CLAuthorizationStatus.authorizedAlways){

      permissionDialog()
      return
      }
      loacationManager.startUpdatingLocation()





      }

      func locationManager(_ manager: CLLocationManager, didUpdateLocations
      locations: [CLLocation]) {

      toast(message: "didUpdateLocations")
      guard let location = locations.first else {
      return
      }

      // 7
      // gsmMapView.camera = GMSCameraPosition(target:
      location.coordinate,
      // zoom: 15, bearing: 0, viewingAngle: 0)
      //
      // 8
      loacationManager.stopUpdatingLocation()
      }

      func locationManager(_ manager: CLLocationManager,
      monitoringDidFailFor region: CLRegion?, withError error: Error) {
      print("Monitoring failed for region with identifier: .
      (region!.identifier)")
      }

      func locationManager(_ manager: CLLocationManager, didFailWithError
      error: Error) {
      print("Location Manager failed with the following error: .
      (error)")
      }


      func permissionDialog() {
      self.toast(message: "Give Always Authorization Premission")

      let alertController = UIAlertController(title: "Permission",
      message: "Please go to
      Settings and turn on the location alway permissions
      for to work",
      preferredStyle: .alert)
      let settingsAction = UIAlertAction (title: "Settings", style:
      .default, handler: ({ (_) -> Void in

      guard let settingsUrl = URL(string:
      UIApplication.openSettingsURLString) else {
      return}
      if(UIApplication.shared.canOpenURL(settingsUrl)){
      UIApplication.shared.open(settingsUrl, options: [:], completionHandler: { (success) in })

      }
      }))
      let cancelAction = UIAlertAction(title: "Cancel", style: .cancel,
      handler: nil)

      alertController.addAction(settingsAction)
      alertController.addAction(cancelAction)
      self.present(alertController, animated: true, completion: nil)
      }


      }



      My swift version is 4.2 and build target version is 12.1 . Please let me know what i am d







      ios google-maps ios12 swift4.2






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 at 12:33









      Usman SaeedUsman Saeed

      115




      115
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Try



          gsmMapView = GMSMapView.map(withFrame: mapView.bounds, camera: camera)
          mapView.addSubview(gsmMapView)





          share|improve this answer
























          • Its showing thanks

            – Usman Saeed
            Jan 3 at 12:46












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022378%2fgoogle-maps-not-showing-loading-ios%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Try



          gsmMapView = GMSMapView.map(withFrame: mapView.bounds, camera: camera)
          mapView.addSubview(gsmMapView)





          share|improve this answer
























          • Its showing thanks

            – Usman Saeed
            Jan 3 at 12:46
















          0














          Try



          gsmMapView = GMSMapView.map(withFrame: mapView.bounds, camera: camera)
          mapView.addSubview(gsmMapView)





          share|improve this answer
























          • Its showing thanks

            – Usman Saeed
            Jan 3 at 12:46














          0












          0








          0







          Try



          gsmMapView = GMSMapView.map(withFrame: mapView.bounds, camera: camera)
          mapView.addSubview(gsmMapView)





          share|improve this answer













          Try



          gsmMapView = GMSMapView.map(withFrame: mapView.bounds, camera: camera)
          mapView.addSubview(gsmMapView)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 12:41









          SateeshSateesh

          2,14711020




          2,14711020













          • Its showing thanks

            – Usman Saeed
            Jan 3 at 12:46



















          • Its showing thanks

            – Usman Saeed
            Jan 3 at 12:46

















          Its showing thanks

          – Usman Saeed
          Jan 3 at 12:46





          Its showing thanks

          – Usman Saeed
          Jan 3 at 12:46




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022378%2fgoogle-maps-not-showing-loading-ios%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas

          Can't read property showImagePicker of undefined in react native iOS