Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
253 views
in Technique[技术] by (71.8m points)

storyboard - After updating Xcode to IOS 9, app stucks on splashscreen and initial viewcontroller is not loaded

Using a storyboard in Xcode, I have an application that worked nicely, but after latest Xcode update (IOS 9), the app stucks on the splash screen. DidfinishLaunchingWithOptions is succesfully called and reaches the end of the function, but the initial viewcontroller is not being loaded.

If I switch the initial view controller to another screen, it works fine..

How can it be that the initial view controller is not loaded for the one screen, and it does get loaded if I set it on the second screen?

I first thought it had perhaps to do with constraints, or UI elements, but even after resetting constraints and removing the UI elements (which are just a set of buttons) still the same problem. There is only basic code in the viewcontroller.m .. (and it is not being called because I have console logs in every function)

Anybody with the same problem or a solution?

Edit 1: It seems that it is caused by one of the UI elements, after removing them all, the view does load.. now trying to add them one by one to see what causes the error.

Edit 2: I tracked the error to one imageview plus textview in the view, without the imageview and textview the view loads, with the image and textview it does not. Selecting a different image for the imageview does not seem to matter. Trying to find out why this imageview or textview is giving errors.

Edit 3: (not applicable anymore) The view in question has 4 images and 4 textviews in a grid, it seems that the images press away the textviews, and when this happens, the view does not load. (perhaps some constraints cannot be resolved..)

Edit 4: The view looks like this (I cannot post screenshot due to NDA)

Image              |           Image
Textview           |          Textview
--------------------------------------
Image              |           Image
Textview           |          Textview  

If we use for all Textviews the same text, it works, if however we change the up-right Textview shorter text, it stucks and does not load.. Is this a bug?? I am really lost.. I repeated the same experiment 3 times, and each time I set the text to the short variant it does not work, for the a bit longer text value it does work..


Edit 5, problem: text cannot be too small

When we set the text of one of the four TextViews to a string that is smaller than ten characters, the view does not load. If we use strings that are bigger than ten characters (any string), the view loads.

This is a very very weird bug, we are now trying to change the bounding box sizes of the textviews, to see if it has something to do with that.

With a string of 9 characters, the view refuses to load. With 10 characters it loads fine, no problem at all. There are no constraint issues whatshowever.

When we use spaces to make it at least 10 characters, everything works fine... This is definately a bug..

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Ok, so in the end the problem was a "too small" text in a textview below an imageview. Why the text was too small, or what "too small" means, no clue. Except that in this particular case it was 10 characters.

The Solution

I changed the initial text of each textview to a string with at least 10 characters. And I change the text after loading the view programatically to the text I want. This works as expected and the view loads.

I will try to file it as a bug to apple, because this can never be the correct behaviour. Thank you all for giving advice in this matter.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...