Forum Xamarin.iOS

google mapview in iOS is null when creating FromCamera() when device is offline

burritoburrito Member ✭✭

I'm using xamarin.iOS to build an app that uses google maps. It's working great when the device is online with the following code:

        var camera = CameraPosition.FromCamera(latitude: 40.48038142908172, longitude: -97.1630859375, zoom: 2);
        _mapView = MapView.FromCamera(new RectangleF(0,0,(float)_frame.Width, (float)_frame.Height), camera);

however, when my device is offline, that _mapView object is null. I did some googling and found that with iOS 7 and beyond, it should still work and I can add some overlays with local tiles (which is exactly what I want to do) but I'm not certain where to turn to create the MapView object to then later add it as a subview in my app.

With android, it just works and the Google map still "loads" and just shows a blank grid instead of map tiles when there is no internet connectivity.

Can someone point me in the right direction of what I need to do to get this _mapView object instantiated when the device is offline? I will leave the fight to figure out the tileoverlays for another day, just need to get this solved first.


Sign In or Register to comment.