View hierarchy debugger only shows views frame - ios

I have a very big problem with View hierarchy debugger in Xcode. This is my only project in which I have this behavior. When I capture the view hierarchy I only see frames and anything else. I already tried the "Adjust view mode" setting, but with no results. It is set on "Wireframes and Contents", but I can't see contents... My project is built with only one storyboard (Main.storyboard) which houses the UINavigationController and the initial view controller of the app. The rest is built with programmatic layout. Didn't find nothing on internet. Do you have any solution? Only system images (SFSymbols) appear.

After more than a year, I decided to try again to solve this problem. I finally solved it! With the latest Xcode releases, when I start the view hierarchy debug tool, an error appears and something is logged in the console. I use a subclass of CAGradientLayer in this screen and a fatal error occurs because I have not implemented the init(layer:) initializer.
I have solved my issue by implementing the method. Now everything works fine!

Related

The layout is changed by setAlpha method, but the view hierarchy I got from Instruments has not changed

I am using Appium to test iOS app, but I think the problem is nothing to do with Appium.
The layout is changed by setAlpha method, our developer use it to show or hide a element(UILabel type), but the view hierarchy I got from Xcode-Instruments-Automation shows there is nothing changed in this subview.
Does anyone know how to solve this problem?
It will be better if there is a way to force Instruments to refresh the view hierarchy.

UIViewController content not displaying on storybord

All the content of one of my UIViewControllers suddenly stop show in my storyboard, all the objects are grey out in my documents outline and the view controller in question is completely blank, however when I run the code it displays fine in my phone and/or simulator.
I try clean and build the project without any success, any ideas how to fix it?
From your interface builder check the property for specific hidden view as Installed (From Utilities)

UISplitViewController - Wrong detail view sizing

I’m maintaining a universal iOS App whose development has started on iOS 6. I’m about the renew the UI for iOS 7. Now I’ve got a weird problem with the iPad part of the app. This part follows the „normal“ Master-Detail view pattern using a UISplitViewController. The UI is configured in a storyboard. The UISplitViewController is the root view controller as requested by Apples docs.
Here comes the weird part: When the detail view controller is embedded in a UINavigationController the navigation controller will be sized incorrectly by the UISplitViewController and so the whole interface looks broken. It appears as if the navigation controller remains in portrait orientation even if the device orientation is landscape. In portrait orientation the detail view controller is looking fine though.
If I avoid embedding the detail view controller in a navigation controller and connect it directly as detail view controller with the UISplitViewController everything is working perfectly in both orientations.
I tried to reproduce the problem in a simple sample App based on the Master-Detail project template provided by Apple without luck. There it works even with a detail view controller embedded in a navigation controller. No matter what I’ve tried so far (looking for categories interfering, rotation settings, method swizzling etc. pp.) I couldn’t find the cause for this problem. As I’m running out of options (if possible I’d rather avoid rolling my container view controller) I respectfully ask if anybody around here has a solution to this problem or further ideas on how to track down the problem.
Thanks in advance
Tino
Found the solution to my own problem. I created a category on UISplitViewController and added a method 'detailViewController' only meant to be a convenience method to access the detail view. Unfortunately the UISplitViewController has an equally named internal method which is was replacing. Would I have followed Apples guidelines to always prefix category methods in order to avoid name clashes I would have saved a lot of my own time. :(

xcode: Problems connecting main storyboard

I am following the tutorial here. I just created my first storyboard and tried to set it as the main storyboard. After following the tutorial I clicked the run button and the simulator doesn't render any of the changes ive created.
I have a screen shot of my xcode project here(not sure how else to display it): https://app.box.com/s/okw7jlzq5zmcetd5cehu
What am I doing wrong?
Here is another screenshot of the storyboard itself: https://app.box.com/s/jt6i0an3maowwvgsamk7
Place a checkmark in the box "Is Initial View Controller" for the view controller you want to load.
I think your problem is the code in the app delegate. When you use a storyboard, you don't need anything in there except "return YES". The storyboard creates the window, so the code you have in there is making another window, not the one that your storyboard controller is a subview of.
Using this tutorial might teach you some things about the structure of an iOS app, but if you just want to make an app with a storyboard, you should start with the "single view" template instead of the "empty" one. It will give you a storyboard and an initial controller.

Xcode: "Scene is unreachable due to lack of entry points" but can't find it

Xcode 4.5.2 gives me the following warning:
Unsupported Configuration
Scene is unreachable due to lack of entry points and does not have an identifier
for runtime access via -instantiateViewControllerWithIdentifier:.
Unfortunately I can't identify the incriminated scene. Selecting the warning in the Issue Navigator doesn't highlight anything in the Storyboard. I have a fairly complicated storyboard (30+ scenes).
Any suggestions?
In your storyboard, select each of the view controller (red arrow in image below) and look at the Storyboard ID field (red oval). None of the Storyboard ID fields should be blank. When you find one that is, that is the culprit.
While this thread is old, I didn't see an answer describing what worked for me, so here goes...
I had this error and visual examination of the storyboard showed that all of the view controllers appeared to be connected to the root view controller.
I tried naming all 17 of the view controllers in the storyboard (as in #bobnoble's answer). I used a naming convention based on the long name of the view controller, e.g. "jvc" for "Jobs View Controller". When I tried to build, I got an error message pointing to one of the view controllers as having a duplicate name. Tracking things down, I found that I had an actual duplicate of a view controller stacked exactly on top of its twin. I suspect it was cut-and-paste damage from a user interface experiment that I didn't back out completely.
Anyway, deleting the unconnected twin solved my problem. After that, I removed all of the VC names as they're not referenced in the code.
I just had this exact error with a simple single-scene Storyboard, and all I had to do to fix it was check the "Is Initial View Controller" checkbox for the 1 view controller in the Storyboard. I suspect Xcode used to check this box for you by default in this situation, but no longer does.
                                     
Check the box for exactly one of the view controllers in your storyboard and you should be good.
I'm afraid you'll have to go through all 30 of them, and check whether they have a Storyboard ID or a segue to that view controller. One of the two is required, both is also an option.
This issue can happen in one the following scenarios:
Case I:
If none of the scene in the storyboard is marked as "isInitialViewController".
Fix:
Identify the root view controller and mark it as "isInitialViewController" in your SB.
In this case storyboard id is is not mandatory.
Case II
There can be situations where you do not need to have a initialViewController in a storyboard. For eg: when using Multiple storyboards.
Fix:
In such cases make sure the "storyboard id" is correctly given and you refer to the first scene to used in the storyboard using this id. For eg:
UIStoryboard *myStoryBoard = [UIStoryboard storyboardWithName:#"MyStoryBoardName" bundle:nil];
MyViewController *myViewController = (MyViewController *)[myStoryBoard instantiateViewControllerWithIdentifier:#"MyViewControllerId"];
In this case "storyboard id" is mandatory.
Case III
You have your initialViewController connected. But still you get this warning.
This is because some of the scenes in the storyboard may not be connected with a "segue" and also they do not have a "storyboard id".
Scan your storyboard, see if a "segue" is needed. Connect the segue if that is missing.
If a segue is not needed make sure you need to give a "storyboard id" since it is the only way to refer the scene from your code, as shown in the example code above.
Hope this helps
You don't need to set Storyboard ID for all scenes or UINavigationController
Well I have around 50-60 scenes and I just got these warning so that I realise that only the controller(Scene) or NavigationController which is not connected with segue needs to set Storyboard ID.
You can see that in above image UINavigationController is not connected with segue, it was a culprit of that warning.
Just give it a Storyboard ID to remove this warning.
I had the same issue. I've got lots of views on my storyboard with a nav and tab bar controller. For me it was just be a warning to let you know that some of the views are not connected.
Make sure all your views are connected in some way to the root view controller. I was starting this project from scratch to eliminate this warning and noticed the same warning when a view wasn't connected.
Simplest way to find the offending scene:
Go to the issue navigator (in the left panel, next to the search button), and double click the error. A window will popup containing the offending scene centered in the middle of the window.
(This is actually generally true - double clicking any error will generally result in a popup containing the error centered - a neat little trick!)
Side note: Sometimes, XCode will incorrectly give this error for a scene that is the root view controller of a navigation controller (that is the initial view controller). Simple fix is giving this root view controller a Storyboard ID, compiling (error should go away), and then removing the storyboardID (no error anymore).
The easiest way to see which controller, or scene, is causing this problem is by:
Ctrl-clicking your .storyboard in the Project Navigator and selecting Open As > Source Code. This will bring up the underlying XML of the Storyboard.
In this view, the warning will be clearly related to a line in the XML that relates to the offending scene.
Now, in my case, the warning was particularly annoying because the "offending scene" had an identifier and a segue! I was able to remedy the problem by deleting the scene and then undoing the deletion. Not elegant, but worked. I saved my Storyboard before doing this. In retrospect, I should have made a copy and diff'd the before-after.
For me, it wasn't because of a Storyboard ID or a Segue. I was receiving this warning because I had not set the View Controller's Custom Class.
Select the View Controller on the Storyboard, then in the Utilities Pane, select the Identity Inspector icon. Under Custom Class, see what value is inside of the Class field.
If it just says UIViewController, then you need to type in the class name. This will be the name of your .h and .m files that make up your custom UIViewController subclass.
I came to this question today. I'm using Xcode 6.3 and the answer to the OP's question is quite simple now:
Select the View Controller you wish to be the first one, show the Attributes Inspector, and under the View Controller section, make sure
Is Initial View Controller
is checked. Voilà!
With Xcode 7 this can be handled easily. There is no need to manually go through all the scenes to find a problematic one.
First go to the Report navigator, where you can get more detail info about known issues.
Issue description can look like this:
Base.lproj/Main.storyboard:fPh-fe-F5F: warning: Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier:.
With this info, you can copy object id, in this case it was fPh-fe-F5F, and search workspace for the occurrence of this string. String will be found in Main.storyboard file. Double click on search result and it will be opened Main.storyboard with selected scene. Once you know a problematic scene you can easily fix the issue, by setting storyboard ID or setting "Is Initial View Controller"
You can just set an identifier. On the attribute inspector on the right pane, you'll find a field called "Identifier". Just put any string in there , this should work
You can click on the navigation controller and under the attributes inspector click the button "is initial view controller", and this should work too.
i faced same problem and solved with put on storyboard ID any identifier for all viewController and NavigationController also; the error will be removed immediately
enjoy!!!
Maybe this XQuery will help you to find those nasty scenes
for $i in .//scene/objects/*[1][not(#storyboardIdentifier) or #storyboardIdentifier= '']/#id (: find every scene that has an empty storyboardIdentifier :)
where count(.//segue[#destination= $i])= 0 and $i!= ./document/#initialViewController (: filter the results to the scenes that are not destinations of a segue and exclude the initialViewController :)
return ($i, $i/../#customClass) (: return the storyboard-id and the customClass, if any :)
If you have xqilla installed, you would save the query to a file and use it like
xqilla <xqueryfile> -i <path to your storyboard>
I don't know if this hasn't been mentioned yet or not but another reason you could get this warning is if you have a segue going in the wrong direction. For example, in my project I was getting this warning but all my controllers were in fact connected. However, one of them had a segue that basically was trying present the parent from the child instead of the parent presenting the child. This caused the same warning.
I got this warning when i am having a UIViewController in Storyboard to which nothing is set.
I avoided this warning by setting Storyboard ID to it.
I had the same issue,but i realized that i was using container view and instead of deleting default view controller i deleted its segue.So view controller remained in storyboard and so was the warning. So this is one of the case where warning pops up if default view controller of container view is not deleted properly when you don't need it.
I tried everything described above to no avail. I had everything connected properly in IB, with exactly one UIViewController designated the root view controller. I had no identifiers but added them to all of my controllers.
The only way I could get the warning to disappear was by doing everything above (including a computer reboot and a clean build) then switching to an error-free branch of my project in git and back again.
Unsure which action fixed it, or which combination of actions, but it wasn't the clean build on its own. This might be a byproduct of Main.storyboard always changing upon simply being opened, which means I have to git commit -m "Stupid storyboard" more often than I want to.
Here is what worked for me:
Open the storyboard in a text editor.
Change version from 3.0 to 2.0 save and close it.
Open it again in visual studio. It will automatically convert and open the document.
I got the same error : For me the error was I did not initiate a view controller in my story board.
Fixing that removed that warning.
Simply giving all MVCs a storyboard id worked for me.

Resources