I am working with xamarin forms project and I have a bug on xamarin iOS project. Currently I implemented functionality of Master-Detail Page and also I added button item on action bar. Problem is when I am running application from my MainPage I am moving to another page from my burger menu and then back again to MainPage , everything seems good. But when I scroll my MainPage carousel to another object and I click on ActionBar item I am receiving such a error:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'CustomNavigationRenderer'.
This is my iOS CustomNavigationRenderer class:
[assembly: ExportRenderer(typeof(NavigationPage), typeof(CustomNavigationRenderer))]
public class CustomNavigationRenderer : NavigationRenderer
{
private string pName;
private int pCCount;
private string pCName;
private App MainApp { get; set; }
public override void ViewDidLoad()
{
base.ViewDidLoad();
}
private void CIndexChanged(int pCCount, string pName)
{
UIBarButtonItem providerBtn = TopViewController.NavigationItem.RightBarButtonItems[0];
}
On debug TopViewController I got such a line:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'CustomNavigationRenderer'.
But until I scroll from current object to another carousel view object TopViewController have such a line on debug mode:
Xamarin_Forms_Platform_iOS_NavigationRenderer_ParentingViewController
What could be main reason, that object do not reach that action bar item?