多个fragment中可能会出现FragmentManager is already executing transactions
xiagea opened this issue · 9 comments
知道解决方法,但是感觉大佬应该可以优化下
知道解决方法,但是感觉大佬应该可以优化下
怎么解决呢?
首先,权限请求不是特别推荐在onCreate 等生命周期回调中调用 ,推荐即用即请求,基于上述遇到的问题可以参考:https://stackoverflow.com/questions/38722325/fragmentmanager-is-already-executing-transactions-when-is-it-safe-to-initialise
1.1.7中已经优化
@xiagea
@davidgerka
大佬真给力,赞👍
1.1.7中已经优化
@xiagea
@davidgerka
我用的是1.1.7版本,貌似问题依然存在;
我在Fragment的onViewCreated中调用checkAndRequestPermission方法,报错信息如下:
Caused by: java.lang.IllegalStateException: FragmentManager is already executing transactions
at android.support.v4.app.FragmentManagerImpl.ensureExecReady(FragmentManager.java:2207)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2267)
at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:814)
at com.qw.soul.permission.request.PermissionFragmentFactory.create(PermissionFragmentFactory.java:27)
at com.qw.soul.permission.request.PermissionRequester.(PermissionRequester.java:27)
at com.qw.soul.permission.SoulPermission.requestRuntimePermission(SoulPermission.java:364)
at com.qw.soul.permission.SoulPermission.access$000(SoulPermission.java:33)
at com.qw.soul.permission.SoulPermission$3.onStatusOk(SoulPermission.java:352)
at com.qw.soul.permission.SoulPermission.checkStatusBeforeDoSomething(SoulPermission.java:345)
at com.qw.soul.permission.SoulPermission.requestPermissions(SoulPermission.java:349)
at com.qw.soul.permission.SoulPermission.checkAndRequestPermissions(SoulPermission.java:174)
at com.qw.soul.permission.SoulPermission.checkAndRequestPermission(SoulPermission.java:140)
at com.guoshujinfu.mobile.gscloud.ui.verify.identity.step1.IdentifyCardFragment.initComponents(IdentifyCardFragment.java:81)
......
@kandroid29 感谢提出,准备在1.1.8修复,即将在这两天更新,这边临时替代方法推荐做一个500毫秒的延时请求权限
@kandroid29 感谢提出,准备在1.1.8修复,即将在这两天更新,这边临时替代方法推荐做一个500毫秒的延时请求权限
感谢大神
@kandroid29 @davidgerka @xiagea
1.1.8已经更新,提高了稳定性,demo中覆盖了ViewpagerFragment的使用场景、
另新加了一些小功能
特地感谢,一开始用的就是500毫秒延迟,更新1.1.8后,不会再报错