UIViewController动画停止工作 [英] UIViewController animations stop working

查看:97
本文介绍了UIViewController动画停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序在iOS6中运行良好,但是在未指定的即将推出的iOS版本中,由于NDA原因我无法命名,所有 UIViewController 过渡动画都停止工作。新视图立即就位。我不确定这个未指定的iOS未来版本是否是原因,因为我在iOS6中偶尔会看到这种情况。

My app runs fine in iOS6, but in an unspecified upcoming version of iOS that I cannot name for NDA reasons, all UIViewController transition animations stop working. New views just pop into place instantly. I am not sure if this unspecified future version of iOS is the cause, as I've seen this happen occasionally in iOS6.

有时动画开始工作一段时间然后不久后停止,让我觉得这是某种内存警告问题,但我的应用程序在大多数情况下使用相当合理的~125MB RAM。任何人都可以提供任何建议或事情来调查吗?

Sometimes animations start working for a while and then stop shortly after, making me think it's some sort of memory warning issue, but my app is using a fairly reasonable ~125MB of RAM at most times. Can anyone offer any advice or things to investigate?

推荐答案

所描述的行为一直存在:如果你在背景线程上工作,然后调用和UIKit方法,然后通常会以一种奇怪的方式延迟更新。

The described behavior has always existed: if you do work on background threads and then call and UIKit methods then more often than not the update will be delayed in a weird way.

因此你应该总是 dispatch_async 进入主队列以更新UI。

Because of this you should always dispatch_async onto the main queue to update the UI.

这些错误很难捕获,因为它们并不总是可预测地发生。

Those bugs are very hard to catch since they do not always occur predictably.

为了捕获它们,我构建了一个方法,它调用一些UIKit方法来检查它们是否在主线程上被调用。这样,只要忘记发送回主队列,就可以停止符号断点。

To catch them I built a method that swizzles some UIKit methods to check if they are called on the main thread. This allows you to stop on a symbolic breakpoint, whenever you have forgotten to dispatch back onto main queue.

https://github.com/Cocoanetics/DTFoundation/blob/develop/Core/Source/iOS/Debug/UIView%2BDTDebug。 m

这篇关于UIViewController动画停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆