GM release of Xcode 6 compile

21 Solutions Collect From Internet About “GM release of Xcode 6 compile”

This error can happen for numerous reasons, so this is meant to be a debugging hint. You may want to try using xcodebuild in the command line. It will give you details as to what files are the culprits.

To do this, open Terminal and go to your project folder. Once there, type in

xcodebuild -project YourProject.xcodeproj -scheme YourScheme

or if you’re working in a workspace

xcodebuild -workspace YourProject.xcworkspace -scheme YourScheme

You may see A LOT of messages pop up, but at the very end of the output you should see the specific files that are causing the crash. Back in XCode, go into those files and start playing with some of the Swift syntax to see what’s going on. In my case, it had to do with the setAttributeString function, but I’ve seen other people have issues with ! and ?.

Hopefully that will get you headed in the right direction.

I had to change my “Optimization Level” to None[-0none]

Target > Build Settings > Swift Compiler > Optimization Level.

My case was a little bit different and it involves enums and optionals. For the simplicity lets define

enum Animal {
    case Dog
    case Cat

func exampleAction(animal: Animal) {}


It will run OK. However as soon as I made the argument optional the error started to appear. So this code won’t work:

func exampleAction(animal: Animal?) {}


To make it work I had to add explicit enum name in the method call. So the following code worked again:


I think it occured for many reasons, what I have encountered is this situation,hope it could help you.

dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) ){ [weak self] in

        // ...
        dispatch_async(dispatch_get_main_queue()) { [weak self] in

            // ...


In the upper code,just delete “[weak self]” called capture list will remove the compiler error. It works for me.

dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) ){ [weak self] in

        // ...
        dispatch_async(dispatch_get_main_queue()) {

            // ...


xCode version is 6.1.1

May be the same issue
Swift compile error in XCode 6 GM

I had the same problem, then I use git checkout old versions to find which commit cause the problem, and try to find the key problem code. My key problem code is something like this

func afunc() {
    class AClass() {
    let ac = AClass()

Other code could make the same problem, occur in Swift Optimization, and swift compiler doesn’t tell you the exact location. This must be a bug by Apple.

In my case i changed 3 places:

Target > Build Settings > Swift Compiler >

  • Optimization Level.
    • Debug: None [-Onone]
    • Distribution: Fastest [-O]
    • Release: Fastest [-O]

When i changed just Debug, i have errors like “Source Kit crashed….”
This combination of parameters, works very good for me!

If you are using some API which should be used in early iOS version, you may get build failure.
For example: If you are using UI_USER_INTERFACE_IDIOM() instead of UIDevice.currentDevice().userInterfaceIdiom to identify the device type, you will get this build error with no hint.

A lot of people have this issue (me included) due to the optimisation on the compiler. I don’t consider turning off the optimisation a correct resolution – I want my code optimised to run as quick as it can.

re-running xcodebuild manually didn’t do any good as it ran it without the optimisations as well.

However – the error screen gave me the swiftc command that was failing:

/Applications/ -target arm64-apple-ios8.0 -incremental -module-name SpaceCats -O -sdk /Applic...

The -O there is the optimise flag.

I re-ran this whole command in the projects directory (as per xcodebuild recommendation above) and amongst all the details I found the error below:

"kind": "finished",
"name": "compile",
"pid": 10682,
"output": "Bitcast requires both operands to be pointer or neither\n  %228 = bitcast i8* %227 to %VSs20UnsafeMutablePointer, !dbg !1322\nBitcast requires both operands to be pointer or neither\n  %324 = bitcast i8* %323 to %VSs20UnsafeMutablePointer, !dbg !1322\nBitcast requires both operands to be pointer or neither\n  %411 = bitcast i8* %410 to %VSs20UnsafeMutablePointer, !dbg !1322\nBitcast requires both operands to be pointer or neither\n  %498 = bitcast i8* %497 to %VSs20UnsafeMutablePointer, !dbg !1322\nLLVM ERROR: Broken function found, compilation aborted!\n",
"exit-status": 1

If you want it to go to a file instead of the screen, add ” 2>filename” to the end.

I then had to find the pid (10682) in the file to see what it was compiling. I ran the command for that pid manually and it gave me the error for the specific file. Then it comes down to fixing the code.

I see many reasons. My answer is not a generic solution but just adding yet another case that provide to that error. In my case it was setting a button’s title like this:

button!.setTitleColor(.whiteColor(), forState: UIControlState.Normal)

instead of this:

button!.setTitleColor(UIColor.whiteColor(), forState: UIControlState.Normal)

In my case this error was caused by the incorrect (UTF8) .swift file encoding;
Solved by copy-pasting the file’s contents into a new file.

Go to the folder: Users/user/Library/Developer/Xcode/DerivedData

and clear all file,

then then clean and analyze,

It`s work to me.

I have the following code showing build error in Release.

if myValue > 5 { myValue = 5.0 }
if myValue < 0 { myValue = 0 }

Adding else between if statements fixed the issue:

if myValue > 5 { myValue = 5.0 }
if myValue < 0 { myValue = 0 }


Xcode Version 6.1 (6A1052d). Builds alright in debug. Submitted ticket to Apple Bug Reporter.

Just to put this out there: I get this error whenever I put [unowned self] in a block within a block, like this:

lazy var someVar: SomeType = {
    self.successBlock = {[unowned self] in
        // ...

The solution is to put the [unowned self] only at the topmost-level block. It seems an unowned reference to self is handled automatically for blocks within blocks.

Of course, I was only able to find this error by first finding out the troublesome file via @Maxwell’s answer:

To add my case here. I got the described error whenever I mark the closure with [unowned self], but never reference the self in the closure itself.

For example:

        request.startWithSuccess({ [unowned self] (req: CBRequest!, object: AnyObject!) -> Void in

            if let result = object["result"] as? [NSObject: AnyObject]
                popup.type = result["email"] == nil ? AuthPopupType.Signup : AuthPopupType.Login
                println("WARNING: Malformed response for kCBCheckUniquenesPath request.")

            }, failure: { (req: CBRequest!, err: NSError!) -> Void in

                println("ERROR: Failure response for kCBCheckUniquenesPath request.")

By following @maxvel’s suggestion, I got to know that
max() and min() functions failed to compile in the release mode. I replaced it with my own functions like below.

//Swift compiler seems to failing to compile default min and max functions in release 
//mode hence writing my own
func maximum<T: Comparable> (one: T, other: T) -> T {
    if one > other {
        return one
    else {
        return other

func minimum<T: Comparable> (one: T, other: T) -> T {
    if one < other {
        return one
    else {
        return other


func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!  


func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell

and do the same to others like this

Maxwell’s solution gives you the closest hint.

Encounter this error when compiling this Swift 2.0 syntax in Xcode 6.4:

print(string, appendNewline: true);

Back to Xcode 7 and the error is gone.

In my case Xcode gave the error because of the following line :

if UI_USER_INTERFACE_IDIOM() ==  UIUserInterfaceIdiom.Phone {

}else {


And to fix the error I’ve defined this :

enum UIUserInterfaceIdiom : Int {
    case Unspecified
    case Phone // iPhone and iPod touch style UI
    case Pad // iPad style UI

And then i used it like :

 if UIDevice.currentDevice().userInterfaceIdiom == .Phone {


Good luck !

I was also getting this error. I ran the the command in Terminal as suggested by @Maxwell and found out the error was in my GameViewController.swift file. A little digging around and found that it didn’t like some auto-generated code or the code conflicted with a setting in Xcode somewhere

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {

    if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
        return .AllButUpsideDown
    } else {
        return .All

As soon as I removed this block the error went away.

I think the real problem is there are too many errors, so the compile tell you only a confused error code.

But you can always open the every source code file, in there you can find the detail error information and correct advice.

Good luck!