# MapView and MapMarker issues

**URL:** <https://forums.fusetools.com/t/mapview-and-mapmarker-issues/5076>\
**Category:** Bug Reports\
**Created:** [June 28, 2016, 10:06am UTC](https://forums.fusetools.com/t/mapview-and-mapmarker-issues/5076 "2016-06-28T10:06:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [June 28, 2016, 10:06am UTC](https://forums.fusetools.com/t/mapview-and-mapmarker-issues/5076/1 "2016-06-28T10:06:49Z")

</div>

Hey there, several issues with `MapView` and `MapMarker`s, running on OSX + fuse 0.21.0.6650.

1. iOS preview on device, does not show the `MapMarker`s at all (same applies to iOS simulator). On Android preview they are put on the map just fine. Presumably, the markers are being put on the map before the map is initialised.

2. Both iOS preview and Android preview on devices die when live-reloading after a file save. Monitor throws the following on iOS:

```auto
ERROR: Object reference was null
    Uno.NullReferenceException occured.
       at Fuse.Controls.MapView.UpdateMarkers()
       at Fuse.Controls.MapView.DeferredMarkerUpdate()
       at Fuse.UpdateListener.Invoke()
       at Fuse.UpdateManager.Update(Fuse.Stage)
       at Fuse.UpdateManager.Update()
       at Fuse.AppBase.OnUpdate()
       at Fuse.App.OnUpdate()
       at Outracks.Simulator.Application.OnUpdate()
       at Fuse.App.OnTick(object,Uno.Platform.TimerEventArgs)
       at Uno.Platform2.Display.OnTick(Uno.Platform.TimerEventArgs)
LOG: One or more errors occurred.

```

and this on Android:

```auto
ERROR: Object reference was null
    Uno.NullReferenceException occured.
       at Fuse.Controls.MapView.UpdateMarkers()
       at Fuse.Controls.MapView.DeferredMarkerUpdate()
       at Fuse.UpdateListener.Invoke()
       at Fuse.UpdateManager.Update(Fuse.Stage)
       at Fuse.UpdateManager.Update()
       at Fuse.AppBase.OnUpdate()
       at Outracks.Simulator.Application.OnUpdate()
       at Fuse.App.OnFrameCallback(double,double)

```

Tested with the following snippet:

```auto
<App>
    <JavaScript>
    var Observable = require('FuseJS/Observable');

    // empty observable for the list
    var markers = Observable();

    // generate 5 random markers
    for (var i = 1; i < 6; i++) {
        var lat = Math.floor((Math.random() * 60) + 1);
        var lon = Math.floor((Math.random() * 90) + 1);
        var label = "test marker at " + lat + " / " + lon;
        markers.add( {'latitude':lat, 'longitude':lon, 'label':label} );
    }

    // make the markers observable available to UX
    module.exports = {
        'markers': markers
    };
    </JavaScript>

    <ClientPanel Background="#eee">
        <NativeViewHost>
            <MapView>
                <Each Items="{markers}">
                    <MapMarker Latitude="{latitude}" Longitude="{longitude}" Label="{label}" />
                </Each>
            </MapView>
        </NativeViewHost>
    </ClientPanel>

</App>

```

- Somewhat unrelated and most probably reproducible - when I’m first opening an app with `MapView` on an iOS device thus triggering the OS Location permission request, the app dies. Same applies to app preview, as well as production build installed Ad-Hoc. Not entirely sure about the cause since I haven’t got any logs from the crash, but I wouldn’t be surprised if this was again related to `MapView` not being initialised on time.

---

<div class="post-metadata">

**Author:** ![Andreas\_Ronning](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/andreas_ronning/32/303_2.png) [@Andreas\_Ronning](https://forums.fusetools.com/u/Andreas_Ronning)\
**Post date:** [June 28, 2016, 11:05am UTC](https://forums.fusetools.com/t/mapview-and-mapmarker-issues/5076/2 "2016-06-28T11:05:00Z")

</div>

Hey Uldis

The MapMarkers not showing is interesting. The way it works internally is that a kind of dummy mapview object is created until the MKMapViews’s viewDidAppear is called via a UIViewController, and then that pointer is switched to the presumably ready MapView and all the properties of the dummy is transferred over.

Do the markers fail to appear in full builds as well? There appears to me there is some discrepancy in the timing of when a property is initialized in preview vs full builds.

I’ll test thoroughly with previews today.

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [June 28, 2016, 11:09am UTC](https://forums.fusetools.com/t/mapview-and-mapmarker-issues/5076/3 "2016-06-28T11:09:34Z")

</div>

> **Andreas Rønning wrote:**
> 
> Do the markers fail to appear in full builds as well?

I can’t test this because of the full builds crashing on iOS upon the `MapView` init when requesting Location permissions ☹

---

<div class="post-metadata">

**Author:** ![Andreas\_Ronning](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/andreas_ronning/32/303_2.png) [@Andreas\_Ronning](https://forums.fusetools.com/u/Andreas_Ronning)\
**Post date:** [June 28, 2016, 11:44am UTC](https://forums.fusetools.com/t/mapview-and-mapmarker-issues/5076/4 "2016-06-28T11:44:11Z")

</div>

Awesome ☹

I’ll get on this, this is all new to me. The permissions thing might be the key. My device builds have always behaved nice, for what little it’s worth.
