Xcode Changes Contraints Of Layout By Itself After Reopening The Project - xcode

I set the constraints of layout properly and also tested it on every device. But the next time I open the project, Xcode just ruined the constraints totally.
How did this happen?

May be the project has a problem and for some reason it is not saving the changes. I have indeed put this solution on my troubleshooting book about Xcode from Apress (shameless advertising... 😃). I have seen this before.
Backup your project and try this:
Quit Xcode
Using finder, right click on the .xcodeproj file of your project and select Show Package Contents.
delete everything from that except the file project.pbxproj.
open the project again fix the constraints and see if the changes are saved the next time you open Xcode.

You did not specify you Xcode version, but my own experiences with code, that is developed using Xcode 8 Beta 1 to Beta 6: The problem may be caused by bug in XCode.
The explanation, if you use Xcode 8 Beta, could be:
New Xcode offers new storyboard-display logic, that shows different difficulties still in Beta 6
After fixing both constraints and frames automatically / manually, warnings come back again after reopening project
This problem moves from Xcode Beta 2 to Beta 6 after my own researches
Let's give Apple a little more time to fix the issues and let's wait until Apple releases GM Seed. It's only beta though

Related

XCode 9 hangs stucks on storyboard of project created in older version

I have a project which was created in xcode 7. I ran it on xcode 8 and it perfectly ran however now when I shifted to xcode 9. and open storyboard it hangs forever and specifically it shows "Signing product on status" on the status bar or shows "building custom shells..."
Any fix so far for this ?
Bug Report Response > Duplicate.
9.01 has not made a difference.
Recommendations:
1. Buy faster Mac with more memory. 3.2 or higher 8GB or more.
2. Close all other Apps: Safari, iTunes, everything!
3. If you have large storyboards break up into 40-50 GUI's each.
4. Run Clean often after editing or switching Storyboards
5. Try not to have Simulator running while editing storyboards.
6. Get a second Mac to do other things while you're waiting for storyboards to open, update and close.
7. Convert Storyboard views to code.
8. Be Patient
9. Pray for Apple to do something about this!
I had a similar problem, I managed to apply all of the following solutions at once:
Change all "Top Bar" and/or "Bottom Bar" to "Inferred" - hard to make this point when Xcode freezes on Storyboard, but after rebooting Xcode I usually had a few seconds in which I succeeded.
Clear Xcode cache data - in my experience computer restart isn't required.
Clearing my xcuserdata
I'm not sure if all the points are required, but I think it's faster to do them all than to try to find out where the real problem lies.

Cannot change file in Xcode project

When I launch one of my Xcode projects, I am presented the storyboard of the project. I can edit the storyboard, I can run the project on my device and simulator. But on changing to any other file from the project navigator or any other way (like opening any file of my project from finder), I get stuck with a rolling rainbow cursor which keeps on rolling till infinity (I have waited for as long as an hour) and I have to force quit Xcode. My other projects appears to work fine.
I have tried the following fixes:
Restarting my Mac
Reinstalling Xcode
Resetting Xcode Settings from http://ioslau.blogspot.in/2013/08/resetting-xcode-settingspreferences.html
I have Xcode v6.3 and Yosemite v10.10.3.
I don't want to recreate my project as it will suck time.
Any help or advice is appreciated.
This may be a known issue with the latest release of Xcode:
apple dev forum
The accepted answer and the apple dev forum didn't help me.
I am using a swift project with no IB and no Storyboard.
What I did was, close Xcode, restart the mac, open the Xcode not from the app but form the .xcodeproject file. It worked.
For me, the solution was to make a copy of the files that were uneditable, delete the original files from the Xcode project and drag the duplicates in.

Xcode 5 crashing all the time when trying to open a particular project

When I try to open a particular projects target settings in xcode 5 it crashes. When I try to open it in Xcode 4 versions its fine.
Screen Shot http://img33.imageshack.us/img33/9527/kiew.png
This got fixed with today's update to the OS. I am using OSX Mavericks!. Make sure to update.
Good luck!
Reverting project file changes and resetting the workspace worked for me: https://stackoverflow.com/a/9494112/974531

Can you install the Xcode 5 Developer Preview in parallel with Xcode 4.6.2?

Apple announced the Xcode 5 Developer Preview today and I want to try it.
But before I download this, I want to know that what happen with my current version of Xcode (version 4.6.2)?
Will the Xcode 5 Developer Preview install as a different application or it will remove the old version? Will some common tools collide, like the command line tools?
The Xcode 5 developer preview comes as a normal app DMG (not with the usual packager/installer) and has a different name.
So essentially, you download it, open a DMG, then pull to the Applications folder and thence have two Xcodes there (the old and the new one called Xcode5-DP). It even comes with a slightly different icon (red badge across a corner) and the intro screen is different too, so there is very little chance of confusing them.
I already did that today (and a colleague also).
Now that xcode 5 has reached the first official release and is no longer in beta, you have to do ONE of the following if you wish to keep BOTH versions.
Run the dmg of the new version you download from developer.apple.com. Drag the app to applications, and when asked to overwrite click KEEP BOTH. This will rename the existing app to xcode 2 I believe.
Select your existing xcode 4 in applications. Rename it to xcode4 or whatever. Now you can drag in the new version without overwriting the existing one.
Drag the new xcode to someplace other than applications. Rename it and then drag it into applications.
I personally favour option 2, since going forward we'll be using xcode 5 and it's helpful if it retains the default name from the get go for easy updating.
BTW, if you do have more than one xcode installed expect the mac app store to report that you need to do an update. Probably best to install it by downloading it from the developer portal if this sort of thing bugs you.
Xcode 5 preview works fine with Xcode 4.6.2 or any other Xcode, It has different icon and it runs from its .dmg file (no install).
Pay attention you cannot submit an app with Xcode 5, So keep the old Xcode till Apple would release the stable version of Xcode 5.
Short answer: Dont replace XCode 4!
If you plan to deploy some app to appstore, you can't do it using Xcode 5 at this moment.
The best way is download the Xcode 5 version, unpack it and run the app on different folder (not application folder). You will stay with Xcode 4, and can run Xcode 5 separated (You don't need to 'install' xcode 5).

Unable to build using Xcode 4 - The selected run destination is not valid for this action

So I'm horribly confused by this error, other threads on Stack Overflow mention I should set the SDK, but I see no option to do this. I'm trying to build:http://wafflesoftware.net/shortcut/
And I get no options, and I can only choose My Mac 64-bit, and I want it in 32-bit. Really beginning to hate Xcode 4.
Here is the screenshot when I try to edit my scheme: http://groovyape.com/scheme.png
Thoughts?
Firstly, I have observed that when Xcode 4 decides my Mac is 64 bit and all my other schemes have vanished, a restart of Xcode fixes that.
If you still have the issue after a restart, go to Manage Schemes... (under the Product Menu) and click on Autocreate Schemes now button. Try to delete the other schemes and see if you can run the project now.
However, if the issue is that you need to set the SDK, that's different:
Click on the top-level project icon in the left hand panel
In the right hand panel that appears, select Build Settings (near the top).
Select "All" option (instead of Combined)
Ensure Base SDK is set appropriately, like "OS X 10.7".
FWIW I'm seriously considering reverting to Xcode 3.2.5 at the moment, 4 seems horrendously buggy.
In xCode 4.4.1, use Validate Settings to solve the problem!
I can select either 32bit or 64bit now.
Ran into the same error message ("The selected run destination is not valid for this action") when attempting to use XCode 4 to build/run a tiny Objective-C "Hello, World" project I created in XCode 3.x. Fixed it by choosing to "Manage Schemes..." from the drop-down menu to the right of the Stop button, deleting the one scheme on the list (click checkbox beside the scheme, then click the "-" button at the bottom left), and then clicking "Autocreate Schemes Now".
I also needed to change the "Base SDK" from 10.5 to 10.6, by clicking on 'folder' icon (beneath the Run button), clicking the root/top of the tree view below it, clicking on the blue icon below "PROJECT" in the pane just to the right, and then finally, choosing "Latest Mac OS X (Mac OS X 10.6)" to the right of that.
I had this issue today. I found switching Base SDK from Latest iOS (4.3) to iOS 4.3 fixed everything.
This will happen if XCode believes your mac is a 64-bit machine, when really it's a 32-bit. If this is the case for you, simply click on your project icon from the far-left pane - it's the menu item that displays your project name next to a little blue icon. This should bring up a center pane that says "PROJECT" at the top. Highlight your project name, and the third pane should now show your build settings. The first item is "Architectures" which will allow you to specify if you are building a 32-bit or 64-bit application.
Kind of amazing that none of the answers here solved the issue for me, but I figured it out. Forget restarting Xcode, or using Autocreate Schemes, still only 64-bit will show up as a valid destination in the scheme.
The correct solution is to change the Architecture for your project. Go to Build Settings (in the root node of your project), and change Architecture to 32-bit Intel, it's right above the Base SDK setting. Destination will instantly switch to "My Mac 32-bit". HTH somebody.
It sounds as if you're trying to run (Cmd-R or run button) the framework (which you can't do - it's not an executable, just a library) rather than simply build it (Cmd-B).
I had this issue and maybe it was a coincidence but when I restarted XC4 but this time didn't choose to load my project from the popup window that appears on launch - instead choosing it explicitly from the File menu - the issue didn't occur and the build started ok.
On the 3 or 4 occasions I had this error, I had chosen to load the project from the popup window that appears when XC4 first loads.
As I say, I might have just got lucky, but I certainly didn't make any other changes to the projects to 'fix' the issue.
I found a good practice for moving from Xcode 3.2.X to Xcode 4 is, to remove any references to older SDKs (in the case of Mac OS to remove any Base SDK Ref, etc., for Mac OS <= 10.5, in the case of iOS I think you need to remove everything <= 4.3) PRIOR to upgrading to Xcode 4.
I never experienced any problems for new Projects, created in Xcode 4, only for such that where created with Xcode 3.X or 2.X
Xcode 4.5. I was trying to compile for 10.6. It seemed to be stuck on 64 bit just because it couldn't find the sdk. I didn't get any message about it not finding the sdk.
I first tried to put in the correct path to /Developer-3.2.6/SDKs/MacOSX10.6.sdk but xcode didn't want to find it there. Then I copied that folder into 4.5 next to the other OSX Platform sdk (new location I think just look in the bundle).
And magically my 32 bit came back.
So my conclusion is that the 32/64 bit option is really dependent on whether xcode can verify the sdk that you're trying to use. Being stuck at 64 while trying to compile for 32 gives the error without notifying you that its first issue is that the sdk can't be found.
I fixed this by deleting my xcuserdata in my Project file. Not sure how it got corrupt. But it worked for everyone else in the office, deleting the xcuserdata did the trick. I made sure Xcode was closed while doing so. Just for fun, make sure you delete your DerivedData folder for the app, and do a build clean for superstitious folks.
If this happened after you renamed your app, go to Schemes -> Edit Scheme -> Run <YourApp> -> Info
Select the right executable file (YourApp.app)
Another way is to select None as executable and then reselect the YourApp.app from your Debug-iPhoneOS folder.

Resources