Slow UIViewController boot time (ClientState slow alert)

Since I converted the old application to iOS 6, I started getting the following message on my console.

WARNING: Slow defaults access for key ClientState took 0.023656 seconds, tolerance is 0.020000

Besides updating my code from iOS 5 to iOS 6, I also switched to automatic linking. I ran Tools / Time Profiler and the rootViewController in my appDelegate application. Each time I switch view controllers, it sucks most of the time (regardless of whether I have to instantiate a view controller or reuse one that already exists).

 window.rootViewController = myViewController; 

I know what the method does superficially, but I'm not sure what is going on under the covers ... what can make it slow now and what can I do to speed it up?

EDIT: I tried removing the storyboard from auto-layout and the problem goes away (of course, my user interface layout is in ruins). So the obvious conclusion is that this is something about auto-layout. I probably have a little less than 70 views, all integrated on the screen, and various restrictions necessary for their calculation. I hardly believe that auto-linking is much slower (from ~ 80 ms, with auto-linking turned off to ~ 1370 ms with auto-linking enabled).

+7
source share
2 answers

Having 70 views on the screen sounds like a lot! My suggestion is to simplify :

  • Do you really need all 70 views at once?

  • Check to see if autorun is required for all views; delete it whenever possible.

  • Is it possible to replace some types of graphics? I used views, for example. for shadows there may have been images

Can you split storyBoard into several smaller ones? one to enter the system, details, editing mode, etc. Part of the slowness may come from a system dealing with (too) large stories.

+3
source

Consider creating a new project with two view controllers and checking the switching speed. Each iOS application has a window, a root view controller, and a view controller. The problem is unlikely to be as narrow and clear as you can hope for. What does each controller load? Have you checked the base code? Does the application delegate do anything when initializing or modifying the root view controller?

0
source

All Articles