我最近将项目从MVVMCross 5.7升级到6.1,并在使用嵌入式Xamarin Forms页面时开始遇到错误。
我的应用程序有几个根片段,每个根片段都有一堆本机页面和表单页面(我们正在逐步将所有内容转换为表单)。当我有两个相互重叠的嵌入式表单页面并关闭它们时,调用ChildFragmentManager.PopBackStackImmediate()
的点将引发以下异常:
[MonoDroid] java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
[MonoDroid] at android.view.ViewGroup.addViewInner(ViewGroup.java:5122)
[MonoDroid] at android.view.ViewGroup.addView(ViewGroup.java:4953)
[MonoDroid] at android.view.ViewGroup.addView(ViewGroup.java:4893)
[MonoDroid] at android.view.ViewGroup.addView(ViewGroup.java:4866)
[MonoDroid] at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1425)
[MonoDroid] at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750)
[MonoDroid] at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819)
[MonoDroid] at android.support.v4.app.BackStackRecord.executePopOps(BackStackRecord.java:855)
[MonoDroid] at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2587)
[MonoDroid] at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377)
[MonoDroid] at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332)
[MonoDroid] at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:851)
[MonoDroid] at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:805)
[MonoDroid] at customerapp.droid.BaseTabHostActivity.n_onOptionsItemSelected(Native Method)
有人知道这两个版本之间的更改可能导致此问题吗?