In my app I had previously been using:
await CurrentNavigationPage.Navigation.PopAsync();
await CurrentNavigationPage.Navigation.PopAsync();
to go back 2 pages. This works fine in Android, but in iOS only the first line got executed. I have since changed to use:
await CurrentNavigationPage.Navigation.PopToRootAsync();
Again, this works fine on android, but now on iOS I get the error below. I made a sample app to try and see if I could reproduce the iOS problem with PopToRootAsync, but the sample app on iOS is working fine. So I must have gone wrong somewhere. Does anyone have any suggestions as to what I could try?
Running stable build 1.3.3 Xamarin Forms.
Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.ViewRenderer`2[Xamarin.Forms.View,UIKit.UIView].SetNativeControl (UIKit.UIView uiview) [0x00000] in :0
at ProjectName.iOS.Controls.SignatureViewRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1 e) [0x00033] in c:\Projects\Xamarin\POC\ProjectName\ProjectName\ProjectName.iOS\Controls\SignatureViewRenderer.cs:26
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[Xamarin.Forms.View].SetElement (Xamarin.Forms.View element) [0x00000] in :0
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[Xamarin.Forms.View].Dispose (Boolean disposing) [0x00000] in :0
at Xamarin.Forms.Platform.iOS.ViewRenderer`2[Xamarin.Forms.View,UIKit.UIView].Dispose (Boolean disposing) [0x00000] in :0
at Foundation.NSObject.Dispose () [0x00000] in /Developer/MonoTouch/Source/maccore/src/Foundation/NSObject2.cs:131
at Xamarin.Forms.Platform.iOS.Platform.DisposeModelAndChildrenRenderers (Xamarin.Forms.Element view) [0x00000] in :0
at Xamarin.Forms.Platform.iOS.Platform.HandleChildRemoved (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x00000] in :0
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00000] in :0
at Xamarin.Forms.Element.OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in :0
at Xamarin.Forms.Page.OnInternalRemoved (Xamarin.Forms.VisualElement view) [0x00000] in :0
at Xamarin.Forms.Page.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in :0
at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in :0
at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].RemoveItem (Int32 index) [0x00000] in :0
at System.Collections.ObjectModel.Collection`1[Xamarin.Forms.Element].Remove (Xamarin.Forms.Element item) [0x00000] in :0
at Xamarin.Forms.NavigationPage.b__19 (Xamarin.Forms.Element c) [0x00000] in :0
at Xamarin.Forms.EnumerableExtensions.ForEach[Element] (IEnumerable1 enumeration, System.Action
1 action) [0x00000] in :0
at Xamarin.Forms.NavigationPage+d__1c.MoveNext () [0x00000] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter.cs:60
at ProjectName.View.NavigationManager+d__1.MoveNext () [0x004c7] in c:\Projects\Xamarin\POC\ProjectName\ProjectName\ProjectName.View\NavigationManager.cs:84 }