Selection is not working on iOS

Hi

I have a simple map and I need to select area. It is working on android perfectly but in iOS it has crashed.

Xaml:
        <maps:SfMaps
            x:Name="sfmap"
            Grid.Row="0"
            BackgroundColor="White"
            EnablePanning="False"
            EnableZooming="false">
            <maps:SfMaps.Layers>
                <maps:ShapeFileLayer
                    x:Name="layer"
                    EnableSelection="True"
                    ItemsSource="{Binding States}"
                    ShapeIDPath="Name"
                    ShapeIDTableField="STATE_NAME"
                    ShapeSelectionChanged="StateSelected"
                    ShowMapItems="True"
                    Uri="AUS.shp">
                    <maps:ShapeFileLayer.ShapeSettings>
                        <maps:ShapeSetting ShapeFill="Gray" ShapeValuePath="Name" />
                    </maps:ShapeFileLayer.ShapeSettings>
                </maps:ShapeFileLayer>
            </maps:SfMaps.Layers>
        </maps:SfMaps>

Error:

  at Syncfusion.SfMaps.XForms.iOS.ShapeFileLayerMapping.GetEnumerable (System.Collections.IEnumerable datasource) [0x00088] in <0be476a8fde244089f55218d804bdb21>:0 
  at Syncfusion.SfMaps.XForms.iOS.ShapeFileLayerMapping.NativeLayerSelectedItems_CollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0008e] in <0be476a8fde244089f55218d804bdb21>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void_object_NotifyCollectionChangedEventArgs(object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00018] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:263 
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:338 
  at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x0001a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:196 
  at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs:71 
  at Syncfusion.SfMaps.iOS.SFShapeLayer.RaiseShapeSelectedEvent (CoreGraphics.CGPoint location) [0x001e4] in <d2a1dda41dce4c70a917c5ce1824a246>:0 
  at Syncfusion.SfMaps.iOS.SFShapeLayer.HandleSingleTap (UIKit.UITapGestureRecognizer tapper) [0x00156] in <d2a1dda41dce4c70a917c5ce1824a246>:0 
  at UIKit.UITapGestureRecognizer+Callback.Activated (UIKit.UITapGestureRecognizer sender) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.1.31/src/Xamarin.iOS/UIKit/UIGestureRecognizer.cs:223 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.1.31/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.1.31/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at OZHealth.iOS.Application.Main (System.String[] args) [0x00001] in D:\ICT Ace\OZHealth\Azure DevOps\OZHealth\Solution\OZHealth.iOS\Main.cs:17 

5 Replies

RS Ramya Soundar Rajan Syncfusion Team May 4, 2020 10:23 AM UTC

Hi Ben, 
 
We have checked the reported issue with code snippet provided. But we were unable to reproduce the reported problem. Please find the sample and video from below location. 
 
Sample Link: 
 
 
So, could you please check the issue with the attached sample and let us know whether it is reproduced or not? If the issue was not reproduced in this sample, please revert us by modifying the sample based on your application along with replication procedure or provide the sample and also share the device details, Syncfusion NuGet and Xamarin.Forms version that you have used. This will be helpful for us to investigate further to provide the better solution. 
 
Regards, 
Ramya S 



BE Ben May 14, 2020 05:12 AM UTC

Hey

I have found the bug and I would like to share with you, maybe you can fix it in your code.

this is my view model:

public class MapPageMasterViewModel
    {
        public ObservableCollection States { get; set; }

        public MapPageMasterViewModel()
        {
            States = new ObservableCollection();

            States.Add(new MapItem { Name = "New South Wales" });
            States.Add(new MapItem { Name = "Victoria" });
            States.Add(new MapItem { Name = "Queensland" } );
            States.Add(new MapItem { Name = "South Australia" });
            States.Add(new MapItem { Name = "Western Australia" });
            States.Add(new MapItem { Name = "Tasmania" });
            States.Add(new MapItem { Name = "Northern Territory" });
            States.Add(new MapItem { Name = "Australian Capital Territory" });
            
        }
    }

and this is my model:
public class MapItem
    {
        public string Name { get; set; }
        public string Code { get; set; }
        public string Count { get; set; }
        public string NameCount
        {
            get { return Name + " (" + Count + ")"; }
        }
    }

as you can see I have not populated Code and Count because I did not use them, so they are null. this is the root of problem.

I think I should be related to memory management of Mono in Android and iOS.

It means if the model has some null properties, sfMaps will not get the selected area in iOS (it is working in Android, magically)

kind regards
Ben



RS Ramya Soundar Rajan Syncfusion Team May 15, 2020 02:02 PM UTC

Hi Ben, 
 
We can reproduce the reported issue and we have logged bug report for this. The fix for the reported issue will be included in our weekly NuGet which is scheduled to be rolled out on May 26, 2020. We appreciate your patience until then.  
  
You can now track the status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.   
 
 
Note: The provided feedback link is private, and you need to login to view this feedback.   
 
Regards, 
Ramya S 



RS Ramya Soundar Rajan Syncfusion Team May 26, 2020 01:40 PM UTC

Hi Ben, 
 
We have postponed our weekly NuGet release to tomorrow May 27,2020. We appreciate your patience until then. 
 
Regards, 
Ramya S 



RS Ramya Soundar Rajan Syncfusion Team May 27, 2020 07:11 AM UTC

Hi Ben,  
 
We are glad to announce that our weekly NuGet was rolled out and fix for the reported issue was included in the weekly NuGet. 
 
NuGet Version: 18.1.0.54
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Ramya S 


Loader.
Up arrow icon