Xcode source code editor freezes, does not scroll any more - xcode

I have a small OS X Objective C project that I am working on for about two weeks now. Yesterday Xcode started to stop scrolling and updating the editor area for the source files. I start Xcode and open the project, I can click on my .m and .h files and scroll around for a while (half a minute or less), then the cursor vanishes, the last file stays on the screen even when I click on other files in the project navigator. No more editing or scrolling. When I select the project file in the navigator, the editor area changes partly to the usual project settings view, but I can't edit anything. Activity Monitor does not show any suspicious behavior of Xcode.
What I did yesterday: I imported and exported localizations several times, changed my app icon, did some minor code changes.
I am using Xcode 6.2 on OS X 10.10.2. Other projects do not cause this problem.
Any ideas where to look at before I start moving everything to a new project?

The problem seems to be Dropbox-related: I moved the project folder from my Dropbox folder to another folder and everything works fine now. I am not sure if it was a temporary network-related problem or a problem with my Dropbox account, but now it is gone.
This was the only project I actually worked on while it was in a Dropbox folder.

Related

Deploy a Swift OS X app locally?

I am not new to programming, but I am new to Swift. I have developed a small app that I have no intention of distributing, I just want to use it for myself. Everything works just as desired in XCode and now I want to deploy that app locally. How can I run my app on my machine without needing to have XCode also running? I just want to see my app in my Applications folder and run it when I want. Does XCode put build files somewhere that I can access them and use outside of XCode?
On the Product menu there is an Archive option. Select that to create an archive of your app.
Xcode should then automatically open the Organiser window with the archive of your app selected.
You'll see a big blue button called Upload to App Store on the right with two smaller buttons below it. The one you want is called Export... Press it and you'll get a pane giving you various export options with different kinds of signing.
The bottom option creates an unsigned .app file which you can put in your Applications directory.
NB As Eric D says, you can just drag the app out of the products directory, but unless you edit the scheme, that will give you a debug build with less optimisation and with asserts activated.
Update for Xcode 11.2
As Bell B. Cooper points out, the process has changed slightly. Now when you archive an app, you get a window listing the apps and a big blue "Distribute" button. Pressing this, gets you a dialog box giving you the various options. Which one you choose depends on what you want to do with the executable. With Catalina, unless it's just for your own use, you probably want to go for one of the options that involves signing the app.
Edit: while this answer still works, it targets old Xcode versions and uses the debug version of your executable. For recent Xcode versions, and for using the release version of your executable, see JeremyP's answer.
Each time you build an OS X application with the current scheme, Xcode automatically populates the "Products" folder with the related app bundle.
You can find this folder in the Project Navigator:
Xcode > Project Navigator > "Products" folder
Your .app is in there and ready to be used and/or copied to the /Applications folder.

Destination toolbar disappeared on XCode 6.4

Today in the morning I tried to compile my project to run in my device and I found the destination toolbar disappeared and I cannot choose my IOS device or IOS Simulator device as target. (I can do it in the Product/Destination Menu)
After some research I found the >> at the right on the screen and when I pushed a Scheme option appeared but it is disabled and I can't enable again.
This is what I tried with no success:
Open an old project to see if the problem was in my project
Create a new project (with Swift and Objective C but I don't think this make any difference)
Restart my computer
Hide and show the toolbar (View menu/Hide Toolbar and the View menu/Show Toolbar)
I tried all the previous options with the device connected and disconnected
I have installed the IOS Simulator 8.4 (when I run my project it runs in the last selected simulator) and XCode 6.4.
Looks like Xcode hides that menu when the window is a certain size. I have to make my window quite large before it comes back.
Not a fix as such but you can work around it using the menus: Product > Scheme and Product > Destination
You're probably running into the same issue I am. Like #BrandonWilliams said in his answer, it appears again if the Xcode window is wide enough. The underlying cause, for me at least, seems to be that in this build of Xcode (6.4) running on El Capitan beta 2 (with Xcode 7 beta installed), I am seeing duplicate simulators for iOS 8.4. And since there are two of the same version, the Schemes dropdown shows some sort of long GUID next to each one, causing the Scheme dropdown to be quite large:
I came to SO looking for an answer but realized that I had seen this issue before.
So the problem is basically that auto layout sucks (I mean it is not working properly in Xcode 6) and on El Capitan, the destination toolbar is for some reason hiding instead of collapsing properly. So when your Xcode window is narrow, the destination toolbar disappears.
But, if you expand the window far enough, it shows back up again.
In case you can't tell, in the first screenshot, the window is about 1241 pixels wide and in the second screenshot the window is 1541 pixels wide.
Go to Product then Destination and choose at which simulator or device you want to test your build.
I'm running with same problem. You can select device or change scheme using below steps:
Select Product from menu
Select Scheme or Destination
Select required Scheme option or Destination option
Alternative Solution:
The only solution is to use Xcode 7 or above. I've installed Xcode 7.1 and found Scheme/Simulator list available. Refer screenshot.
It seems that Xcode 6 or below doesn't support OS X El Capitan.
I am still seeing this problem in Xcode 7.2 on iMac with resolution 1920x1080. Resizing the XCode windows dens't help. I can have the menu bar back if I push the green button and go to full screen mode. But that's pretty annoying. This is how I finally figure out a solution that works for me. I notice that only if I open the project file that I have been working daily that the menu bar is missing. If I create a new project, the menu bar is there. And here is my solution:
Remove your project file on disc (or move it to a different folder)
Open the Welcome to Xcode window by shift+command+1
Make sure your project is no longer under this list. If it is still there, click on it and Xcode will tell you the project is not found and it will be removed.
Add the project file back and open it and I have my menu bar back (if you have moved it, simply opening it from a different file location may work I guess)
I guess the problem is that some cache value in Xcode about the project file is messed up somehow. Hope this helps.
I make my XCode screen little big and now find both options.
On XCode 9.0 beta, this worked for me: select View -> Show Toolbar from menu
right click on title bar -> select show toolbar
Fixed it by deleting the following file ~/Library/Preferences/com.apple.dt.Xcode.plist and restarting Xcode.
The downside is that Xcode preferences dropped to defaults obviously.

Xcode 6.3 freezes when I quit the Main.storyboard

I'm experiencing a very strange error: my Xcode is freezing when I quit a certain storyboard of a certain project.
When i open Xcode, the xib shows up normally, I can even edit it and save it. But when I'm trying to open another file, any other file, it freezes forever.
I tried to delete every temporary files as described here, or here, or here, but the problem still remains. Ah, and... re-create my xib is obviously not an option...
Any other idea?
EDIT:
When I delete myProject/[project.xcworkspace/]xcuserdata (s), I can navigate in my project as usual while I don't open the storyboard. otherwise my problem comes again.
Since my post about this problem, I saw it on other projects. I'm pretty sure this was linked to custom fonts in xib, because it often happened after an Xcode bug rendering custom fonts.
Few days ago I downloaded the last Xcode version, 6.3.2, and the problem did not bother me again. So it seems to be resolved.

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 project corruption

I've been working on an iOS project in XCode for a while now (XCode 4.4.1). This morning, I started up XCode (first time fresh for a while) and it started downloading an update. Once this was done, I noticed that most of my project was gone. All of my original files had been removed from the project. I checked the filesystem and they were still there.
I restored the project folder from Timemachine but the project was really confused and throught it was a MacOS project. So I created a new project and just copied my files into it.
That kinda of worked but now when my app runs it always runs in portrait mode even though I've set the project options to only run in landscape mode. In landscape mode, the text (and buttons and such) are all 90 degrees off. When I rotate the simulator the app does not respond.
I've set the storyboards to all run in both inferred and landscape orientation but neither worked.
Am I missing a project setting that will let my app work again?
Has anyone else suffered a project corruption like this?
I saw something like this when I migrated to iOS 6. I just bit the bullet and manually changed my MainWindow/RootViewController setup into a MainStoryboard. It worked out pretty well. Make sure you've disabled devil autolayout too.
Problem solved: I'm dumb.
The project was corrected so I rebuilt it. Being stupid, I changed the name of a couple of files (the view controllers) but forgot to update the storyboards. That's what happened when things go bung at 5AM.

Resources