Xcode reports errors, after building successfully - xcode

Xcode 4.5 (but also earlier I think) reports build errors, but I just created a successful build. And it also depends on which file I select in the project browser. Some files give errors, others don't.
This leads me to believe that there is a bug in the auto evaluation of my code. It seems to loose the #imports or deeper links to other headers...
I have been without the problem for a while, but today it returned. Very strange and annoying.
Is there an autocompletion cache to delete or something.
(Deleting derived data didn't help, or cleaning the build.)
Has anyone found a way to fix this?
edit: still happens in Xcode 4.6
Might help to use #class more in headers, but unverified.

Related

Opening Storyboard fails with "An internal error occurred. Editing functionality may be limited"

Im running Xcode 9.2. My storyboards are completely useless now. Ive
experienced what this article shows and have tried everything the
article suggested.
My issue occurred when I tried to add a single swift file to an existing
objective C project with about 320 files in it already. I removed the
.swift file entirely from the project, then did everything in the article
link above and still nothing fixed it including removing/reloading XCode
several times trying different things.
I filed a bug with apple but haven't received any replies in a week (of course). Apple seems to be slammed with tons of bugs lately they keep
creating.
Now I cannot work on this project's storyboards at all and Im dead in the
water. Really not happy with Apple lately!
Is there anything more that anyone has had success in fixing this issue?
Im completely dead in the water on this application now.
Fixed this by setting the command line tools version to the correct one. Mine was blank in Preferences / Locations
For my case, whenever I open a storyboard from a workspace, this happens. So I got rid of cocoapods and workspace, then just use carthage for thirdparty libraries. Storyboards opens faster and without this error.
Note that the storyboard I am testing is empty.
This turned out to be stupidity on my part. I had a script that was killing certain processes on my Mac over and over and it turns out that was my issue. When I removed it everything worked as normal again.

Xcode doesn't create swiftmodule

I've spent the past few months converting a project of mine with about 1500 source code files into Swift. It was incredibly tedious, but I finally did it. It runs well, builds well, but:
When I attempt to archive the project, Xcode fails with the following error:
ditto: can't get real path for source '/Users/USER/Library/Developer/Xcode/DerivedData/
APP-dtsbrzschafjiubelceuxtfwstqf/Build/Intermediates/ArchiveIntermediates/APPCore/
IntermediateBuildFilesPath/APPCore.build/Release/APPCore.build/Objects-normal/
x86_64/APPCore.swiftmodule''
Command /usr/bin/ditto failed with exit code 1
APP being the app and APPCore being the embedded framework.
What I've tried:
cleaning the project (which really has no effect when archiving, since archive always compiles from scratch)
using Xcode 7.2 beta (released a few days ago)
making as many declarations as possible non-public
disabling any Swift optimizations for the release build configuration
building the APPCore framework as release - which actually works (!) - and does (!) create the .swiftmodule file
The last part being the strangest here. This evidently points to the archive doing something slightly different, but I have no idea what.
My question is if anyone has any idea why is this happening and how to debug this. I've spent the last two days trying to figure this out, but no results...
I've googled this error as well, but unfortunately, the answers were fairly limited and suggesting to comment all lines of code and then start slowly uncommenting them until the project builds. Which is OK for a smaller project, but not for a 25KLOC project, mainly when you have absolutely no idea where to start...
I had the same issue and your question actually helped me to solve it (Xcode 8).
In debug mode just got the "ditto: can't get real path for source" without any further information. Switching to release mode showed me that the problem was that the framework wasn't allowed to have a bridging header file. I went to the build settings and removed the bridging header file (don't know why there was one) and it now compiles both in release and debug mode.

Xcode 6.4 crashes in Swift breakpoint

In one project I'm using I can't set breakpoints in Swift code, Xcode always crashes when reaching one of them, doesn't matter if it's a "manual" or an exception breakpoint.
In other projects everything works as expected, only for one project Xcode 6.4 (6E35b) always crashes.
I tried cleaning, deleting derived data, resetting simulator, restarting Xcode/Mac - nothing helped at all.
Anyone else experiencing this problem and hopefully knows what helps?
EDIT
Seems only to be the case on one machine (Xcode 6.4, 10.10.5), but not on the other (Xcode 6.4, El Capitan). But as I mentioned in the comments, reinstalling Xcode didn't help, are there some other preferences I could reset/delete?
EDIT2
Here's the Xcode crash log file:
https://dl.dropboxusercontent.com/u/119600/Xcode_2015-08-12-074655_Stefans-iMac.crash
I would try uninstalling and reinstalling Xcode to see if it helps... I've heard of successes with this technique for similar issues.
Just delete the entire Xcode.app from /Applications, and reinstall from the .dmg. If you're not certain of the binaries and have time / bandwidth, consider re-downloading the .dmg.
If that doesn't work, try the following source control tricks (substitute "your favorite revision control" for "git"):
Try purging all objects not in source code control
Another approach: Check out the app again into a fresh repository (this will get even the files that may have been committed but ignored later).
If not under source code control, grab a .gitignore from here and add it to git, then check out into another directory (this will leave everything but source, interface builder, project files and resources/assets behind).
I'd suggest moving the breakpoint code to another location (such as making a function call and breaking either before or inside the function). However, if all Swift code has this problem, that may not work.
Finally, after making an interim commit (to roll back to), try it in Xcode 7 beta. Bit of a hassle because you have to upgrade to Swift 2.0, but if you keep the deployment target the same no iOS target changes are needed.
If this really is a burden and/or it's a small project, you could try creating a new project and migrating the files and storyboard over, but likely this is too much effort.
Either way, since you note it's pretty much all breakpoints in Swift code, file a bug with Apple's bug reporter. They really need to hear about issues such as this, since you don't seem to be alone in having this issue.
EDIT: Where are others seeing this issue?
Maybe we can see commonality -- since this is only reported in Swift projects (so far). A colleague has seen this problem with breakpoints (as well as stepping through code) in Xcode 6.4 on 10.10.4. (I've seen Xcode 6.4 crashes in the past as well).
I see OS version 10.10.5 mentioned as a target where this happens (#swalkner); is this a beta? If OS 10.10.4/5 is the only place we see this, it might be significant. If it's a project/OS interaction, it might be tricky to reproduce / fix, but I'd encourage everyone to submit detailed bug reports to Apple (maybe even link this post).
Some points to note if you're seeing this:
Operating System Version
Hardware
Target: Simulator vs. Hardware; iOS vs WatchKit app.
Target SDK version(s)
Swift only? Or on an Objective-C only project? Mixed?
Only one project, or several?
It's a longshot, but let me know if it's working:
uncheck the "Always show Dissasembly" check
Debug > Debug Workflow > Always Show Disassembly
In older versions of Xcode (<6.1):
Product > Debug Workflow > Show Disassembly When Debugging
I've just spent the past few hours trying to solve exactly the same issue.
I thought at first, it had started due to installing Xcode 7 on the same machine as Xcode 6.4. The problem certainly coincided.
However, due to having version control, I could look and see what files had changed since opening the project with Xcode 7.
The images.xcassets file had changed. Reverting this file back has stopped Xcode from crashing each time it hit a breakpoint.
I'm not sure whether this helps at all, but definitely look at images.xcassets and if needs be, delete it, recreate it and ensure it's setup 100%. It certainly fixed my issue.

Xcode 5.1 compiler errors after adding a framework

So I am new to Xcode and Macs and I seem to be getting a lot of errors after trying to add a new framework. I needed the NSMatrix class and it was not included in the default frameworks (Foundation, CoreGraphics, UIKit, XCTest were. So I added the AppKit framework using Project Navigator>General>Linked Frameworks and Libraries. After I added that and #imported Appkit/AppKit.h in the .h that needed the NSMatrix class the errors for NSMatrix went away and it turned blue. Indicating that it found it I assume.
After that I tried compiling the project and got these errors:
http://i1346.photobucket.com/albums/p694/parkertmorris/ScreenShot2014-04-07at42152PM_zps3a1fdfdd.png
I tried removing the AppKit framework and the reference to it and compiling but I still get these errors. I also tried cleaning the project and deleting the DerivedData folder but nothing is changing.
Any ideas how I can fix this? Tried to research this problem for at least an hour.
Thanks
You and I are both new users (although I am a long time reader) to SO, and as such I'll try my best to help :)
I noticed you tagged this under "iOS". AppKit and NSMatrix are OS X specific, not for iOS, and you may want to remove the iOS tag as such and tag the question appropriately.
When problems like this happen to me in XCode, which occur less frequently with experience but still at annoying intervals, I tend to step backwards using Git (or whatever SCM you like) to a point where things are the least messed up. Based on the fact that your compiler errors are still occurring without AppKit/NSMatrix references, your problem likely exists independent of the framework, or at least alongside the framework.
Try opening your project.pbxproj file inside your project package and looking for duplicate entries of .h files under the same groupings. These types of problems sometimes bite me when rebasing/merging in Git and 90% of the time I can fix them with a very simple change to my project.pbxproj file. Even better, try diffing your previously working .pbxproj with it's current state and see what's going on.

Installing and Using Pantomime Framework... Pantomime/Pantomime.h not found

I just downloaded and compiled Pantomime for SMTP use in my Cocoa Application. The first issue was that it is old... so I changed the build settings to use the most recent SDK as well as eliminate the old PPC build settings.
After those changes, everything compiled nicely (or at least appeared to do so.)
Next, I installed the Pantomime.framework into the /Library/Frameworks directory per Apple documentation recommendations.
Then, I imported the framework into my project under the Build Phases tab where it says "Link Binaries to Libraries".
So far everything seemed to work as it did with WebKit.framework, and ScriptingBridge.framework.
Finally, I added the following to my code:
#import <Pantomime/Pantomime.h>
I got as far as "Pa" when it auto completed the rest, so it apparently knows what I'm looking for. However, when I try to compile my code, I receive the following error:
Lexical or Preprocessor Issue "Pantomime/Pantomime.h" file not found.
All of the other frameworks seemed to work, but this one does not, and I really don't know why (I'm relatively new to working with frameworks.)
Anyone have any ideas on what I'm doing wrong here?
Thanks!
I've never used Pantomime, but this happens to me all the time with Xcode, so although I'm a newbie to development in general I'd wager it's just a bug with Xcode. Here's how I fix it:
In Xcode, hit command-1 to switch to the Navigator's file/folder view.
Reveal the Pantomime.h and .m files in the Finder, wherever you've stored them.
Drag them into the Navigator.
Xcode will prompt you to confirm adding again, and I usually leave it set as is to "copy files if needed".
Xcode will import. You should then delete the old references in the Navigator. It should work fine after that.
I have met this problem.
The solution is setting 'Build Settings' --> 'Header Search Path' Value where your pantomime is. Good luck!

Resources