UIViewController - 神秘地加载缓慢 [英] UIViewController - mysteriously slow to load
问题描述
我正在编写一个基于标签的通用应用程序,其中一个标签的加载时间比其余标签要长得多(大约5s),并在执行时锁定主线程。
I'm writing a tab-based universal app where one of the tabs takes considerably much longer to load than the rest (approximately 5s), and it locks down the main thread while doing it.
现在,这个特定的选项卡是一个图像库,所以可能需要一段时间来加载和显示图像,但是,之前我实例化时会发生延迟我的任何变量...(无论如何,图像加载都是在一个单独的线程上完成的......)
Now, this specific tab is an image gallery, so it could be expected to take a little while to load and display the images, however, the delay occurs before I instantiate any of my variables... (The image loading is done on a separate thread anyway...)
我在 viewDidLoad
方法,但延迟发生在init方法之后和 viewDidLoad
方法之前。
I create my subviews etc. in the viewDidLoad
method, but the delay occurs somewhere after the init method and before the viewDidLoad
method.
(即使我在 viewDidLoad
方法中注释掉所有内容,也会出现延迟。)
(The delay is present even if I comment out everything in the viewDidLoad
method.)
使用nib初始化View Controller,只包含 UIScrollView
和 UIImagePickerController
.. 。
The View Controller is initialized with a nib containing nothing but a UIScrollView
and a UIImagePickerController
...
有谁知道正在加载/处理的是什么在 viewDidLoad
方法之前编辑?
Does anyone know what's being loaded/processed before the viewDidLoad
method?
推荐答案
这是一个加载问题手机上的UIImagePickerController连接到xcode线束。这会产生比正常延迟更长的时间。尝试在设备上进行测试,而无需连接到xcode调试器。
This is a problem with loading UIImagePickerController on the phone while being attached to the xcode harness. This creates a longer than normal delay. Try testing on the device without being connected to the xcode debugger.
这篇关于UIViewController - 神秘地加载缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!