Xcode 8.3.2 keeps on building after every keystroke - ios

Whenever I try to change anything in my source files, the Xcode builds the entire project.
And since, I am in between writing the code, its obvious that there are errors (like "NSLog(#"ABC")") will throw an error if written halfway like this "NSL").
If I leave it idle, it fails for 5 to 10 times more and finally I see build succeeded. And again, when I try to change anything, it rebuilds on every keystroke and fails.
I have tried unchecking, "show live issues", "continue building after errors". Even a deep clean (command+shift+alt+k). After cleaning, its ok, but when I rebuild again, the same nut job building process continues.
This issue is not related to IBDesignables also. I have tried to uncheck "Automatically refresh views" in the storyboard and it did not work.
Any help?

Looks like, I can't open my storyboard as a different window, not even in a new tab. I used to have one of my windows for the source code and one for storyboard only. This made the switch between storyboard and source code much faster. But may be because of IBDesignables, its not possible anymore.
The problem is partially solved. Even if I open my storyboard now, it shows the same behavior of rebuilding again and again. But atleast, I can write my code in peace now with only source code files open in different tabs/windows.

Related

Including a Playground in my project

I'm working in Xcode 9 on a Swift project, and I'm in table flipping mode with this.
Here's my end goal: put my tests next to my logic in a playground so that as I write the logic, I can see the tests pass in close to real time.
I will also accept how to put my tests in a playground by themselves, I just don't want to be running tests on a simulator for every little thing.
My problems in trying to get this to work are many. First and foremost, I can't find a way to add a playground directly to my project/workspace. When I right click on a group in the project navigator and select 'New file...' I get this:
As you can see, no option for playground. Filtering also returns no results. If I press the plus button at the bottom of the project navigator, the same dialog (with no playground option) pops up.
I thought it's in another menu so I went to the File menu, and in "New >" I find an option for creating a playground. I select a blank playground from the chooser, choose where to save it (strange that it wanted to save it under 'Unsaved Xcode Documents') and a basic playground comes up in a new tab. Odd thing I notice, though, is that there's no longer a play button or scheme/simulator selector at the top on this tab.
It now doesn't recognize ANY modules other than Apple provided ones! And sure enough, creating the playground didn't actually add it to my workspace. I guess I have to manually add it to my project. Upon doing so, it will recognize my pods but none of my project files! Any class I try to use gives me an Unrecognized identifier. Trying to import my project doesn't work either, it just gives me a No module.
I tried clearing DerivedData, I tried cleaning, I tried restarting Xcode, I even made sure I had an iPad Pro in the list of simulators (since that seems to matter for some people).
In frustration, I deleted the playground, and resolved just to deal with running my tests constantly. But now, my project has persistent errors! Despite moving the playground to the trash, Swift continues to error saying 'Unresolved identifier' for that playground!
As the excellent Brandon Williams says in his talk at FrenchKit, a playground "does not get access to anything in the application target." Which is ridiculous, but hey, what are you gonna do. So the answer is: there is currently no way to do this the way I asked.
It IS possible, however, to achieve this functionality if your logic is in its own framework/cocoapod. That is, move the logic you want to test out of your app target and into an outside library that your app, subsequently, imports. This will allow your playground to import it as well, and you can test to your heart's content.

Xcode 7 crash every time I try to print something in the debugger console

I've searched around and can't find anything on this.
Using Swift 2 and Xcode Version 7.0.1 (7A1001). Every time I execute something in the debugger console, Xcode crashes.
The project is not very big, and has less than 10 third party frameworks.
I can't think of much more information that's relevant, but I'm sure there's more, so please do ask me if there's anything I should add to my question that would help.
I've of course cleaned build and derived data.
It's driving me insane. Thanks!
UPDATE 16/11/12
Submitted rdar://23559366.
How are you maintaining your third party frameworks? Via Carthage?
If so then this is probably your issue: https://github.com/Carthage/Carthage/issues/924
This is an issue if the location of the /Carthage/Build/iOS folder is in a different location to where it was produced (i.e if it was compiled on a different machine and the absolute file path has changed).
A temporary fix would be to run carthage build --no-use-binaries on your machine to rebuild the symbols using the current absolute file path working around the bug.
But if you wasn't using carthage then its probably not your issue so sorry
I had similar problem with Xcode whenever I hit breakpoint.
In case you see this screen right before your Xcode crashes - you are lucky and my fix might save you. All you need to do is open this window and in the Project Navigator, select any file that you want, so that instead of that white blank view you would get your code. After this you are most likely will be able to successfully stop your app at your breakpoint and perform the debug.
I am not sure why this happens, but I suspect that the reason is Debug View Hierarchy mode, which you might have triggered prior to setting you breakpoint and trying to stop at it. At least this is when it happens to me.
I have similar problem earlier.
If you try to print non-optional variable and unfortunately it holds nil value then it breaks/crash. so that make sure declare all possible variables as "Optional type".

Cannot run program in Xcode

I've recently made an app and could successfully run and test it until this suddenly happened,
fail to run program
It doesn't looks like an issue, but the "run" button is unavailable. Usually it should look something like,
successfully run a program
As in the image, first there are two buttons, run and stop, after that there is the name of the program/app and its icon (fun facts) and then the iphone simulator it will run on (iphone 6). On the image on top, the failed to run program attempt, it is totally different, first the run button is disabled, second, the icon is a gear and not the app icon, and third, there is no simulator, it appears "my mac".
I don't know why this happened but this cannot let me run the app. I searched in the apple documentation and didn't found anything. If someone knows how to solve this please tell me.
The simplest solution is to rebuild your project from scratch. This is not difficult because you still have all your code. So, start with a new project from the iOS template. Copy your code from the old project into the new project.
And try to avoid renaming your project from now on, because there is a bug in some versions of Xcode where it crashes and destroys the project in just the way you describe in your question.
And update to the latest version of Xcode, because it is less likely to cause this problem (though in fact I have not found it reliable for renaming projects even now).

Xcode stalls on "loading" when trying to create new project

Xcode 6 never gets past "Loading" when I try to create a new project. I actually was able to create a new project yesterday, but I decided to just ditch it completely (deleted). Clearly there must be a bad file somewhere, possibly related to the project I deleted, since I also see the same stalling behavior now with Xcode 5.1, which has worked fine for creating new projects in the past. Xcode 6 has worked fine when starting with an already existing project and still appears to do so. I did not see this exact problem in your data base, though one person saw the project creation freeze before reaching the stage I get to. Their solution was to delete Xcode and every possible file related to it, which I'm a little squeamish about, since I don't want to affect existing projects, and don't have an understanding of what the various files are for.
Deleting the DerivedData of Xcode should fix the issue. You can do this by heading to ~/Library/Developer/XCode/DerivedData (with a Finder window open press cmd+G) and deleting all the subfolders of it.
This is embarrassing, but if it could happen to me, maybe it could happen to someone else. The problem was that the window that came up after the second step in defining the type of project to be created, the one in which you choose where to save the project's files, extended off the bottom of the screen, so that only the very tops of the buttons were visible. Eventually, I realized the one to the far right might be the one to click to continue. Which it was. Feel free to delete this question.

Xcode 6 Code Sense stops working after build

So this same problem exists for a long time apparently. I checked all the xcode 4 code sense problems and used their solution and it works. Right up untill I build the file to run and then code sense stops working. I Really dont want to keep deleting the file in organizer and restarting xcode everytime. Is there a simpler method to fix this.
The first thing I always do when I lose Code Sense is to clean the project. If that doesn't work I use Watchdog to clean it. Watchdog deletes the derived data for the project like you can do in Organizer but it allows you to set up a handy keyboard shortcut which saves a ton of time now that Organizer doesn't have a keyboard shortcut.

Resources