Xcode Source Compiling Order Issue - xcode

I am working on a fork of the Xbox HID project (to allow greater configuration of the controller) and came across a really strange issue.
The project is three projects, which I have grouped together under a workspace, which works well, it compiles them in order (kext, daemon and prefpane) and all works.
However, I decided to uncrustify the code (thanks Alcatraz!) and standardise the names and locations of source files. This required me to update the project as file paths changed.
Once this was all completed the PrefPane wouldn't load. For some reason it was instantiating and sending initWithBundle to an object that was NOT the File's Owner in the XIB.
After a lot of debugging and hair-pulling I discovered the object it was instantiating also happened to be the first file listed in the Compile Sources build phase. Once I moved the correct file to the top of that list the PrefPane once again launched and worked as expected.
That seems wrong, why does it need to compile this particular class first... better yet, why is it picking up only the first compiled class instead of the one specified in the XIB?
I am using Xcode Version 6.2 (6C131e) under OSX 10.9.5, however, I am using the OSX 10.6 SDK and have 10.6 as the deployment target.

I was having some other issues with the project in question, so I rebuilt all three projects and this issue went away.
I am guessing there was some sort of issue with the Xcode project itself as I believe it was probably upgraded from at least two previous major versions of Xcode.
Lesson here seems to be, rebuild the project files themselves and see if that fixes the issues!

Related

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.

"aFile.m" is not part of the build phase of any targets in this workspace

I'm asking this question again since the other one had an answer that did not work for me.
I'm getting this message when trying to rename a class, along with code sense and color syntax broken.
The file is in the build phase of the target.
I'have tried erasing the derived data to rebuild the index. I can see the index rebuilding but this does not help.
I'm using Xcode 4.2
I found it to be a bug in Xcode 4.1 under OS X 10.7.1 along side with other issues i had. When I reopen my project, the message was gone, refactoring worked as expected and auto-completing worked as well.

Xcode 4 - Error Starting Executable

I've been working on a project in Xcode 3.2.5 and today I tried migrating it up to Xcode 4.0. It compiles just fine; I can navigate to and execute the .app without a hitch (as expected). The only thing that is screwy is the fact that Xcode cannot launch the application, and displays the following error when it tries:
"Error starting executable. No executable file specified. Use the "file" or "exec-file" command" (image not available)
I've scoured the Project and Xcode settings and have been googling for half the day, but all I can find are dead ends and people bashing other people about breaking Apple NDA. FYI Xcode 4 has been released, and is no longer under NDA.
Should I just start a new project and copy in my source? Sounds wrong to me, but brute force works when brute force works.
Thanks in advance
At a guess, the schemes it set up for you based on your v3 targets and build settings might not be quite right. From the schemes menu, choose to edit the current scheme, then select the Run action from the list and make sure the appropriate exectuable is selected.
I ran into the same issue this question came up so I spent my time identifying the issue, reproducing the issue, narrowing it down and explaining as best I could how to not make it happen - as well as the general frustration that comes with an issue like this (it hit me on 2 different versions of Xcode in 2 weeks).
If you're going to delete my post then at least take the time to try and answer the question as I had tried to do.
Now, on to the reply that actually tells how this issue may be created and how to avoid that.
I JUST had this happen creating an app for iOS. Why? I renamed my target executable.
Just tested this by checking out a new copy of the source and rebuilding.
The app ran fine on my device.
Went in to Xcode 4.2, renamed the target. Ran the app. "Error starting Executable..."
I changed the filename back. Same error.
Cleaned and ran the app again and it launched.
Renamed the app, cleaned and ran it again. Not so much luck.
Don't rename your app by renaming the target.
This is such a stupid limitation. Apple lets you rename your target app, but by doing so, this prevents your app from launching on the device.
EDIT: I haven't checked in any code, but now I can't check out and build and run any app without this happening. How do you get the device/xCode out of this state once you've gotten it in to it?
Even the app now crashes on launch at int retVal = UIApplicationMain(argc, argv, nil, nil);
This is in Xcode 4.2 on Snow Leopard, but I got into the same state with Xcode 3 on another Machine last week.
Edit 2: Rebooted the device, rebooted my Mac. Built and ran in the simulator first, then on the Gen4 iPod touch. It works.
I had this issue when migrating a project from Xcode 4 to 4.1, and it ended up being due to the Target's "Product Name" being different in the debug and release configurations. A holdover from when I changed the name of the product many versions ago. So check that...
I've downgraded Xcode from 4.2 to 4.1 only to encounter an error at build and run on device: "Error starting executable. Don't know how to run ...". I've cleaned the project (Xcode > Project > Clean) and cleaned the build folder (Xcode > Project > (hold option key) Clean Build Folder). After that I had to build again and it built okay on iPod touch 4g running iOS 5.
Well, it sure sounds like a whole family of bugs behind that error message!
I got the error after loading up an Xcode 3 project under 4.2.x for the first time.
None of the above tips worked for me, however what I eventually did was switching from GDB to LLDB.
That fixed it.
It looked like the new path to the executable wasn't properly recognized by GDB (i.e. once locally at PROJECT/build/Debug/... in Xcode3 but now in the usual temp. folder location with Xcode 4 it was still looking for the executable in the build folder relative to the project sources)
I duplicated the target and rename the copied on to different name, I got this error message. What I did is to clean the project, exit Xcode, restart the Xcode, then it can run on my device.

How do I get MailCore to work correctly?

I'm trying to build MailCore into my app but I keep getting
"_OBJC_CLASS_$_CTCoreAccount", referenced from:
That is the only error I'm getting and CTCoreAccount is in the project.
In order to use mail core framework, visit the link follow step by step process and you are done.
I have an answer. It is not "The Answer" but I have an answer and it worked.
Eidt: For this: After a slew of issues, I've realized that "this" particular fix is that you need to add libmailcore.a to the frameworks. It keeeps getting deleted by XCode, or you may ahve added the MailCore Framework instead.
Started a fresh project, erased everything by removing application files to trash, then deleting references. "Added" via group (unsure if it matters) all my folers/files from the project I was trying to.
Had to tell it where the pch and Info.plist were, (essentially pointing it to my old project). Re-added all frameworks, and voila, it compiled.
I'm suspecting XCode 4.5 has different framework settings as far as library paths and valid flags for linker, etc. But nothing I tried regarding that fixed it. I would love to do this more direclty, old project is on 4.3, and won't be upgrading it if this is happening. Anyway, up and running, hope others are soon too. Would like real answer myself

Resources