How can I delete the Xcode constraints? - xcode

I upgraded to Mavericks and installed Xcode 5.0.1.
I opened one of my projects, which targets 10.6, and declined the option to upgrade to "Upgrade to take advantage of Xcode 5 features?" which mentioned Auto layout.
Now 2 of my xib files have errors (the other 12 seem OK):-
error: Illegal Configuration: Auto Layout on OS X prior to 10.7
warning: Attribute Unavailable: Identifier on OS X versions prior to 10.7
Attribute Unavailable: Automatically Recalculates Cell Size on OS X versions prior to 10.8 - 0n NSMatrix
How can I delete the constraints?

See this SO answer
You need to disable autolayout for the NIB completely since 10.6 doesn't support it at all.
If disabling autolayout doesn't clear the other two warnings, you should be able to click the "!" warning symbol to be taken to the offending setting. Looks like a couple of checkboxes simply need to be unchecked.

Related

Xcode 11.2.1 not showing object in library

I do not have objects in my Xcode Library.
Xcode - Version 11.2.1 (11B500)
OS Catalina - 10.15.1 (19B88)
It was about hour ago and then disappeared. Xcode restarted, Macbook restarted. Last stable Xcode and Catalina OS.
Library automatically changes according to what file you are editing (plus some configurations for the file like Canvas open state). For example:
ViewController.swift
Main.Storyboard
MyProject
As you can see, each file represents a different library with different taps and different default tap is selected. So make sure a design (.storyboard or .xib) file is selected and try again.
Note that sometimes you need to open Canvas to see Objects in Library if you are using SwiftUI
Also note that you should check the other monitor too if you have multiple monitors.

Xcode 5 Cocoa App Fails to Load Nib on OS X 10.6

I'm creating a Cocoa application for 10.6 and newer OSs. I created a brand new document-based application in Xcode 5 (10.9) and changed two settings to make it 10.6-compatible: I changed the deployment target to 10.6 and turned Auto Layout off on both MainMenu.xib and xxDocument.xib, the two default nibs that are included with the document-based template. I archived my application (no code signing) adding no other code and tested it on four different OSs. Here are the results:
OS X 10.9: Launches and shows a new document window ("Your document contents here") as expected.
OS X 10.8: Launches as expected; same as 10.9.
OS X 10.7: Fails to launch; Console applications yields "App Name: Unable to load nib file: MainMenu, exiting".
OSX 10.6: Fails to launch; Console yields same as 10.7.
I'm quite baffled as to the behavior of my application. I added absolutely no code to the template document-based app that Xcode created for me; I just changed the required settings to make it compatible with 10.6 and up. I also tried turning off ARC in the build settings, which made no difference at all. I checked Apple docs and also searched for other questions about the console error I received, but none of them were related to this problem. I was very surprised that 10.7 exhibited this behavior, as 10.7 is compatible with ARC. I would greatly appreciate any advice on how I can fix this problem. I would suspect that there is an easy modification to the default template, as Apple probably wouldn't supply a template that requires extensive modification to merely get it working. Thanks.
UPDATE:
As suggested, I turned off base internationalization in Xcode. I ran the app, and it worked fine. I exported the application (no code signing) and tested on all of the above OSs. This time, the error that I received above occurred for all OSs. This even occurred on the SAME machine that I built the project with, the only difference is that I didn't run it from Xcode. My next step was to actually make a MainMenu.xib file (because removing base internationalization deleted the old one) and set that as the main interface. Now not only do I get the error in the exported application on all OSs, but it shows up in Xcode when I try to run the application! Is there something else that I am missing?
AS mentioned before you need to disable Internationalization Base.
In the Project Navigator Click on the on the first item which is your project (denoted by blue page with white A in it, it is the root of all other items)
You should by default see the Info page to the left (if not select it from the tab at the top)
The last item in the Info property sheet is Localization. Under Localization you will have the ability to add and remove languages and you should by default have two already Base, and English.
Delete both, and deselect the check box "Use Base Internationalization"
Once you have done this, remove the any *.xib files you have from the project itself. MAKE SURE TO ONLY REMOVE REFERENCES !!!DO NOT SEND TO TRASH!!!
Once the references have been removed, go into Finder, Open your project directory and you will find a directory called Base.lproj with your *.xib files located in them. Copy or move them one level up to your project directory, and delete Base.lproj directory.
Go back into xCode and add back in your *.xib files. ++K to clean the project, then ++R to rebuild.
This should move the *.xib files in the App Package from Base.lproj (where 10.6 does not seem to find them) to the Resources file folder, and solve the problem.
Newly created Xcode 5 projects have base internationalization turned on. Base internationalization is supported on OS X 10.8 and later. You'll have to turn off base internationalization to support 10.7 and 10.6. See the following Stack Overflow question for more information:
Base.lproj/MainMenu.xib is not available when compiling for targets before Mac OS X 10.8
Another thing you may need to do to support 10.6 is to set the deployment target to 10.6 for both the project and the xib files. I know you said you set the deployment target to 10.6 in your question, but it wasn't clear if you set it for both the project and the xib files. As you're discovering, Apple's project templates do not place a high priority on compatibility with old OS versions.

What is the XIB deployment target? (OS X and iOS)

My app must run on OS X 10.6 through 10.9. The main window xib has a deployment target of 10.6 (same as the app itself). The main window nib also has the "Full Screen" attribute set to "Primary Window".
Since 10.6 doesn't support NSWindowCollectionBehaviorFullScreenPrimary, XCode 5 expectedly gives the warning Attribute Unavailable. Full Screen behavior on OS X prior to 10.7.
Questions
Can you ignore this warning and build safely for 10.6 without a crash on nib instantiation?
You can remove this warning by setting the xib deployment target to 10.7, but will the nib still run on 10.6? In other words, doesn't a xib deployment target of 10.7 cut off support for 10.6?
The "proper" solution seems to be to keep the deployment target at 10.6, unset the Full Screen attribute in the xib, and instead set it programmatically at runtime if running on 10.7+. Is this how you should always handle situations like this?
Generally, how does OS X fall back when attributes specified in nibs don't exist at runtime? I can't find a straight answer. Thank you.
The deployment target is the earliest OS version that can load the xib file. To answer Question 2, setting the deployment target to 10.7 cuts off support for 10.6. The nib file will not run on 10.6.
You listed the solution for supporting 10.6 and later in Question 3. I don't have an answer for Question 4.

"View Based content mode on OS X versions prior to 10.7"

View Based content mode on OS X versions prior to 10.7
Identifier on OS X versions prior to 10.7
This comes up as a warning when trying to use the "Source List" object in IB. My build target is set to 10.6 for development/release and it does build.
Would I be right as to assume this would actually crash in 10.6? Why does it let me even build it?
If you look immediately above the warning in the Issues Navigator, you'll find that it's under a heading named something like “Unsupported Attribute”.
So the full warnings, including the heading that is meant to go along with them, are:
Unsupported attribute: View Based content mode on OS X versions prior to 10.7
Unsupported attribute: Identifier on OS X versions prior to 10.7
In other words, it's telling you that the “View Based content mode” and “Identifier” attributes are not supported on OS X versions prior to 10.7.
The problem isn't that the table view is a source list; that was introduced in 10.5. The problem is that:
You have given the table view (or something in it) an identifier, and
You have created the table view as a view-based table view.
Of course, the main reason to give anything in a table view an identifier is for view reuse, so these are really one problem.
Solution/TL;DR
You're trying to use a view-based table view in an app for 10.6. That won't work. You need to either require 10.7 (or later) or make a cell-based table view.

Xcode 4.1+ Autolayout checkbox missing

I am trying to enable autolayout for an iOS project but cannot find the checkbox in the info panel. I know it's supposed to be under the versioning section and above Localization. I also see that the documentation says:
Note: Auto Layout is available only in Mac OS X v10.7 Lion and later. If you are running Xcode 4 in Mac OS X v10.6 Snow Leopard, Auto Layout is not available.
from:
http://developer.apple.com/LIBRARY/IOS/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/InterfaceBuilder/InterfaceBuilder.html
I'm on Lion and running Xcode 4.2 and the checkbox is not showing. Any thoughts?
Auto Layout is implemented in AppKit in 10.7, so 10.7 is required to develop and to run. It isn't in iOS 4 or 5.

Resources