+[CATransaction Synchronize] 在事务中调用
如果我在从服务加载数据时关闭 iPad 应用程序,该应用程序会关闭,但随后会立即再次打开,而无需我执行任何操作。此时此刻,我什么也做不了;我无法关闭应用程序,也无法与应用程序或设备交互。再次使用该设备的唯一方法是重新启动它。该应用程序不会崩溃,它只是禁用设备。
发生这种情况时,在applicationWillResignActive和applicationDidEnterBackground之后,控制台中会出现以下行三次:
+[CATransaction synchronize] called within transaction
如果应用程序崩溃,那几乎没问题,但事实上,设备变得完全无用是一个大问题。如果我能够拦截此错误或以某种方式检测 CATransaction 何时引发此问题,那就没问题了。
有什么想法吗?
If I close my iPad app while I'm loading data from services, the app closes but then immediately opens again without my doing anything. At this point, I am not able to do anything; I can't close the app and I can't interact with the app or the device. The only way to use the device again is to restart it. The app does not crash, it simply disables the device.
When this happens, the following line appears in the console three times right after applicationWillResignActive and applicationDidEnterBackground:
+[CATransaction synchronize] called within transaction
It'd be almost okay if the app crashes, but the fact that the device is rendered completely useless is a huge problem. If I could intercept this bug or somehow detect when CATransaction raises this issue, then that'd be fine.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当主线程上发生多个动画时,就会发生这种情况。我遇到了同样的问题。在我的例子中,应用程序在 CALayer 动画和旋转设备的同时冻结。所以我在旋转设备时停止了动画。
查找代码
确保此代码中的动画不会与主线程上的其他动画重叠。
This happens when more than one animations are taking place on main thread. I faced the same problem. In my case application freezes while animating the CALayer and rotating the device simultaneously. So I stopped the animation while rotating the device.
Look for the code
Make sure that animation inside this code does not overlap with your other animations on main thread.
如果您使用 UIWindow.rootViewController 完全跳过故事板,这可能会显示在日志中。
要放弃日志消息,您可以删除 Storyboard,删除 info.plist 中将 Storyboard 与您的应用关联的键,将
LaunchScreen.storyboard
设置为目标中的Main Interface
并使用内部
AppDelegate
来获取主窗口
并在其上分配您的UIViewController
。This can show up in the logs if you use
UIWindow.rootViewController
to skip storyboards altogether.To ditch the log message you can remove the storyboard, remove the key associating the Storyboard with your app in info.plist, set
LaunchScreen.storyboard
as theMain Interface
in the target and useinside
AppDelegate
to get the mainwindow
and assign yourUIViewController
on it.