在事务中调用当点击 UI 搜索栏并显示键盘时

Called within transaction When UIsearch Bar clicked and keyboard showed

我做了一个 ViewController,其中有一个按钮和 UITextfield,当我单击该按钮时,会显示一个带有 UISearchBar 的 UITableViewController 并显示一个语言列表。我的问题是当我 运行 应用程序第一次单击按钮然后单击控制台上的 UISearchBar 时我收到此警告

SearchDebugApp[2237:558457] +[CATransaction synchronize] called within transaction SearchDebugApp[2237:558457] +[CATransaction synchronize] called within transaction SearchDebugApp[2237:558457] +[CATransaction synchronize] called within transaction SearchDebugApp[2237:558457] +[CATransaction synchronize] called within transaction

此消息仅在我第一次单击 UISearchBar 时出现,应用程序似乎没有任何问题,所以我现在不知道为什么会发生这种情况以及我应该如何调试它。

我搜索了这条消息警告,我发现当主线程上发生多个动画时会发生这种情况,但在我的应用程序中,唯一发生的动画是在显示键盘时。

You can clone project here

看起来这甚至发生在 Apple 示例项目上: Table Search with UISearchController example

您可以下载该项目并 运行 它,您将看到相同的 4 [CATransaction 同步] 在事务中调用