Storyboard warning not shown - ios

In Xcode Version 7.3.1.
Storyboard warning not shown in one mac, but shows on others. What would cause it and how to fix it?
I have tried following ways, but none of them work.
re-open Xcode
Reboot Mac
Clear DerivedData
Warnings are all autolayout constraints issues.

Things you can try:
verify both are Xcode 7.3.1
send the files from each computer to one place and diff them
click on the red or yellow warnings, and see what constraint is at fault, and manually look on the other Mac to see if it has the same constraint.
My guess is the files aren't identical.

Please try:
Right click your storyboard -> Open as -> Interface builder.

I figured it out what causes the warning eventually:
Earlier, I changed the “ landscape" from w:Any h:Any to w:Regular h:Compact, which impacts the constraints.
That causes the storyboard no showing warning in mine, but in other people's mac, "landscape" setting is still w:Any h:Any, there are conflicts.

Related

Xcode 9 Storyboard: an internal error occurred. editing functionality may be limited

When I am opening my project in Xcode 9, getting above error for Storyboard and Launchscreen.
Note: Cleaning derived data didn't help me.
Please have a look at the screenshot.
You can find the issue in Problem Report, just clink on report a bug and open the log.txt file where you can find the issue. In my case i set invalid table row height.
I was getting same issue in Xcode 10.2.1
I have open interface builder (Story board) as source code just like attached screen shot by right click on storyboard file
Followed below steps
Updated version 3.0 to 3.5 <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0"
Open storyboard as interface builder again
Its get refreshed now and I was not getting error now and view was proper also
However when I revisted the spruce code of story board the version reverted to 3.0 again.
But this worked for as refresh and resolved my problem
Trash derived data by two ways either by command or Preferences.
rm -rf ~/Library/Developer/Xcode/DerivedData/
or
Xcode -> Preferences -> Location -> Derived Data
In Xcode menu go to product clear the project.
Disconnect connected device and restart Xcode and system.
More: https://www.e-learn.cn/content/wangluowenzhang/266937
This generally happens when you have a compiler error in the code that the editor can't figure out or handle. So it crashes. Unfortunately, the only way to fix this is to find out the piece of code and fix it.
I had this when Swift could not figure out the type for one of my variables.
This answer is worth checking out as well.
After quite some tries I was able to fix it here. Xcode-select was pointing to a wrong version of Xcode (here pointing to Xcode 8.3.3).
To check, use
xcode-select -p
To change, use
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
The problem seems to occur when using a Xcode 9 instance while xcode-select points to a Xcode 8 version.
In case you need to use Xcode 8.x again, don't forget to switch back.
When it was happen to me at that time I have configuration was like,
OS : macOS Sierra Version 10.12.6
Xcode : 9.0
I have created new project and open storyboard and this error was there.
Solution : I just quit the xcode and start again and error was not that.
So, it's just requires restart of xcode!
Mostly this error occurred when you have open 2 different version of Xcode.
Solution: Please close both Xcode and clear drived data.now again try, use one Xcode at a time
Check image density. Change to 72dpi or more.
I have also faced this issue.
Solution is very simple just delete the derived data of xcode and restart the xcode.
Just quit (Forcefully if needed) the Xcode and start again.
For me, Just quitting Xcode and open again solved this issue
Xcode 9.4.1
MacOS High Seirra 10.13.4
I had the same issue today
Xcode 10.1 ; Quit Xcode & Restarting Mac Book fixed this issue for today,
I fixed this issue by-
updating my Mac to MacOS High Siera
deleted Xcode
installed new Xcode from AppStore
I faced the same issue. And solved by updating Command Line Tools and/or deleting unused/older Xcode versions,
Go to Xcode Preferences > Locations,
Update Command Line Tools to Xcode 9.0
Delete derived data
Additionally, delete older Xcode versions
Restart Mac
This error is a general error when something goes wrong with Interface Builder. Unfortunately, the error itself does not point to a specific cause. It is sometimes an error in the tools, sometimes an error in the OS, sometimes an error in developer code, and sometimes an error in user configuration.
Common causes include:
Incorrect permissions / ownership set on files.
Manually deleting files in ~/Library/Developer.
Installing buggy 3rd party kexts (especially security or firewall software).
Xcode 9.3
Empty Storyboard/ new project
macOS High Sierra 10.13.4
For my case, this happens when I open a storyboard from a workspace.
So I got rid of workspace and cocoapods. Then just use xcode projects and carthage for thirdparty libraries. Storyboards open faster and without this error.
I just resolved the same bug which appear on my xcode 9.3.1 by following below step,
Clean the projects
Quit the xocde
Removed BUILD folder from project folder
Open again
I also had this issue and I tried most solutions provided here.
In the end, what helped me was quitting Xcode (Version 10.1) and restarting my MacBook.
Just FYI, I got this answer and in the log it said...
Exception name: NSInternalInconsistencyException
Exception reason: scale must be > 0
The reason turned out to be that I'd been converting to dark mode and making my button etc. icons using Image Assets. It turned out that I had a tab controller and the pages it was pointing to did not have their icons set to asset catalog images yet.
Just Quit project and again open Story Board will ok with all the design controls. In my case .
For all others that is facing to this problem and had no luck deleting derived data, it seems there is a bug when you try to add aspect ratio between a element and superview. So when you add aspect ratio constraint and then after you change the second element in the inspector to superview, the constraint is still in the element hierarchy but it should be moved to view hierarchy or, better, add the aspect ratio constraint dragging from element to superview and selecting equal width.
The same problem, Xcode Version 12.0 (12A7209). Apple from Xcode 9 to 12 didn't fixed no one problem with Storyboard.
Solution: Just Re-open your project.
I faced the same problem and error in my storyboard today. One of my controllers was showing nothing but a black background and blue outlines.
I fixed this as follows
Create a new controller
Copy views from the old (dysfunctional) controller to the new controller
Connect views to their respective outlets in the .swift file. (Constraints weren't lost when I copied the views from the old to the new controller)
I had this problem using Xcode 12.2
Some time after adding a UITabBarController to my storyboard, I started getting this error. Checking the log provided by Xcode, I figured out that it was related to the tab bar controller, specifically because it's not supported as detail view for split view controller. Weird, because I didn't use split view controller.
=================================
ASSERTION:
=================================
Failed to update scene 'ihF-5r-7AU, uvd-WH-zGG, Tgo-fH-4sa, ExD-dD-O6v, BUC-1K-8XU, and SVS-tP-wFU' with IBLayoutConstraint (x120), IBUIViewAutolayoutGuide (x6), UIButton (x3), UIImageView (x2), UILabel (x14), UINavigationItem (x5), UITabBarItem (x2), UITableView (x3), UITableViewCell (x2), UITableViewCellContentView (x2), UIView (x15), and UIViewController (x6).
Exception name: NSInvalidArgumentException
Exception reason: UITabBarController is unsupported as viewController for -[UISplitViewController setViewController:forColumn:] in Primary column
Finally, as someone pointed out, I checked the storyboard source code and found a few splitViewMasterSizeMetrics tags, one tag per tab from my tab bar controller. I deleted those tags and worked like a charm. I don't even know how that split view references were added as I've never used it on my project
So my take would be:
check your log
if you can't still figure out the problem, search on the storyboard source code for any occurrences related to the error
I had the same issue. Very old project and UI builder showing just boxes and giving the scale must be > 0 error. Had some old graphics in the UI with less than 72 dpi. Deleted those / replaced them with 72 dpi or more and voila. Instantly everything was OK. Did the usual delete derived data and reboot and and and but this was the cure.
-> Check images less than 72 dpi and repair them.
Quit Xcode and reopen it without using Rosetta and everything will be OK.
Step 1) Open storyboard as source code as shown below:
Step 2) You will see this line on top, change version="3.0" into version="3.5"
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3) Step 3 Restart Xcode.
Hope this will help you.

Layout issue in Interface Builder XCode 8.3

I have this weird issue in interface builder. When I place a UILabel in a UIView and drag it to the leading/trailing end of its superview I'm not seeing any blue line (which is usually 8 points from the edge).
I tried to find if there's an option in Editor menu to reset it but no luck.
Anyone faced the same issue and resolved it?
Here we go :]
The problem is that Xcode is an IDE with quite a lot of bugs. They are usually very small, but sometimes very annoying.
I always restart Xcode from time to time.
And when something isn't working, as it should, restart of Xcode solves this problem in 99% of cases.
So, try to restart Xcode. Hope it will help.
Solved it by enabling Snap to Guides from Editor menu.

Empty storyboard after downloading Xcode 8

I had a storyboard in Xcode 7.3.1 that was set to Compact width and Regular height. When I downloaded the Xcode 8 beta and opened my storyboard file, I get an error: Internal error. Please file a bug at bugreport.apple.com and attach "/var/folders/xl/2m4k1hnj70bbc2dz94sbl029pc_hk8/T/IB-agent-diagnostics_2016-06-17_10-28-34_051000". I'm also unable to see anything on my storyboard.
Bug? I set the view to iPhone 6s.
Thanks in advance!
When people default to editing a storyboard in Compact-Regular (which has always been strongly discouraged) their views and constraints get added only for that very specific configuration, and don't apply to other size classes. If this is the case for your document, one option is to use the File inspector to uncheck "Use Trait Collections" (prior to Xcode 8, it's "Use Size Classes") and choose to keep the data for iPhone. Then re-check the box.
Please do file a bug at https://bugreport.apple.com, you only need to be a registered developer, but registering is free. The IB team can investigate what's going in with your project. Attaching the diagnostics folder mentioned in the warning will help provide the detail needed to diagnose the bug.

Layout attributes relative to the layout margin on iOS versions prior to 8.0

What would be causing the following warning (and subsequent alignment issues on iOS 7)?
Attribute Unavailable: Layout attributes relative to the layout margin on iOS versions prior to 8.0
None of the posted answers solved the problem for me. But the reason for this is the following: Xcode 6 creates constraints based on relative margins by default. Those are only available on iOS 8.0 and newer. You get these warnings when your deployment target is set to iOS 7.0 or lower.
The way I fixed the warning:
Click the warning in Xcode
Attribute inspector will open the constraint
Search for item that has margin (see screenshot)
Turn off Relative to margin option
Disable "Prefer margin relative"
Unchecking the "Prefer Margin Relative" checkbox will keep you from getting into the situation where you get this warning.
If you are like me and you built an entire app with constraints before realizing the problem, then things are a bit tougher because Xcode will not easily tell you which constraints are a problem.
In order to avoid rebuilding all of my constraints, I resorted to looking at the actual .storyboard file and I looked for constraints like this:
<constraint firstItem="vId-..." firstAttribute="top" secondItem="In7-..." secondAttribute="topMargin" id="C0H-..."/>
Notice "topMargin". The attributes ending in "Margin" cause the warning. I went through and identified the constraints in the file this way, then I removed and re-created them in IB. After that, this warning went away.
I suspect this should also resolve some inconsistencies between iOS 7 and iOS 8 constraint handling, although I am still encountering some differences in behavior, even after addressing all Xcode warnings.
I'm currently in the same situation as I'm creating an app in Xcode 6 that targets iOS7 and 8. That warning appears because the constraints relative to the margin aren't available in iOS7, but they are created by default in Xcode 6.
You can absolutely go back and edit the constraint to not use that 'Relative to margin' feature as suggested by the other answers to this question.
When creating new constraints, I hold down the Option key when choosing which kind of constraint to create. This gives me the ability to create a constraint that's not based on the margin right away so I don't have to go back and fix it afterwards.
Xcode 6 creates constraints based on relative margins by default.
So, if you want to force remove all baselines attributes and don't want to search all bad constrains in Interface Buidler, to support iOS 7, I can recommend this way
To find and remove all dummy strings with "Baseline" in constraints you can do this:
Close Xcode
Open your stroyboard file in your favorite text editor, that supports regexp.
Find and remove from storyboard file all strings by pattern: .*"baseline".*\n
Now save file and open it in Xcode
Fix all appeared misaligns: find all warnings and press "Update constraints for all views" to save original position of all views.
Profit!
UPD:
I found that "baseline" constraints causes crashes also, but Xcode doesn't show any warnings about these constrains!
To fix it - remove from storyboard file all strings by pattern: .*"baseline".*\n
I took a non programmer approach.
I knew which view controler was causing the 8.0 margin message. So, I went to my constraint list. I had 33. I've remove every one that was causing the 8.0 margin message. I went down to 20 (So 11 was problem).
Select 32 over 33 delete and see the result. Select 31 over 33 delete and so on ... Naturally when the message still there ... delete the problematic one.
So it took me 5 minutes to resolve the error message.
Other constraint messages did appear but that's not a big deal.
Ok than, redo and resolve step by step the constraint messages but this time check that all the constraint you add don't provoke the reappearing of the 8.0 margin message. If so, undo and take an other strategy when adding constraints. There's always an other way to add a constraint that work.
That's not what is proposed by Xcode but it will do the job.
At the end, your done.
If you have more than one view controller, and don't know witch one is causing the 8.0 margin message, try to isolate each view controller. May be in a separate test project with a copy and paste or deleting all the other view except one and se the result.
Using the "Create Snapshot" in the file menu can help you if something goes wrong.
Suppressing the warnings: I went through all IB constraints and deleted all that said "First Baseline...". This made all of these warnings go away. However, IB will reintroduce the warnings if you "Add missing constraints" or "reset to suggested constraints".
Possible cause: From a fresh Xcode 6.1 project, I copy/pasted ViewControllers in Storyboard (lazily), using "reset to suggested constraints". Then changed the project target from 8.0 to 7.1. This caused the warnings to pop up. I noticed that the warnings only occurred on certain of my ViewControllers, which I believe were the ones I copied/pasted in Storyboard.
Suggestion: If targeting 7.1, set it up front before using IB. Don't copy/paste view controllers in Storyboard. And be wary of "new warnings" when working within IB, so hopefully we can confirm the cause of this annoyance.

Inspector size on xcode 5 is showing nothing

In xcode 5 with iOS7 target project the size inspector in storyboard is not work. When I have one element selected like a button, view or anything else and I go to size inspector of storyboard all is empty showing nothing.
I tried restarting Xcode, unchecking Autolayout, uninstalling an reinstall Xcode and nothing. This problem persists.
Is very strange that on other Macs I open the project and size inspector works correctly then not is a project issue.
If someone have the same problem and solve it. Please tell me how can I fix.
Thanks.
The answer that helped me is here. MouseOver "View" shows Button "Show".
Reinstall of MAC OS X solves this issue 100%. In inspector size. But in size inspector you've probably noticed the "Show"|"Hide" watermark an the right top corner of panel. I agree that these hidden invisible buttons in IB is not the best solution in terms of UX. But Apple knows better :)

Resources