Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GM release of Xcode 6 compile

Tags:

xcode

ios

swift

I just downloaded the GM release of Xcode 6 and it won't compile with this error:

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

Any ideas on how to fix this?

like image 829
bhzag Avatar asked Sep 10 '14 23:09

bhzag


People also ask

What's new in Xcode 6 3?

Xcode 6.3 includes a new version of the Swift language, Swift 1.2, with significant changes, fixes, and enhancements. See the following sections of these release notes for details: A source migrator tool has been provided to help update your Swift source code from Swift 1.1 (Xcode 6.2) to Swift 1.2 (Xcode 6.3.)

When was Xcode version 7 released?

On June 8, 2015, at the Apple Worldwide Developers Conference, Xcode version 7 was announced. It introduced support for Swift 2, and Metal for OS X, and added support for deploying on iOS devices without an Apple Developer account. [36] Xcode 7 was released on September 16, 2015.

What is the last version of Xcode with GCC?

Xcode 4.1 was the last version to include GNU Compiler Collection (GCC) instead of only LLVM GCC or Clang . On October 12, 2011, Xcode 4.2 was released concurrently with the release of iOS 5.0, and it included many more and improved features, such as storyboarding and automatic reference counting (ARC).

What version of iOS Simulator is used in Xcode 5?

^ "iphone - ios 6.0 Simulator in xcode 5.1 - Stack Overflow". Retrieved May 2, 2015. ^ "ios - Xcode 6 Standard architectures exclude armv7s - Stack Overflow".


3 Answers

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.

like image 63
Maxwell Avatar answered Oct 19 '22 09:10

Maxwell


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

Target > Build Settings > Swift Compiler > Optimization Level.

like image 25
Byron Coetsee Avatar answered Oct 19 '22 09:10

Byron Coetsee


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) {}

exampleAction(.Cat)

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?) {}

exampleAction(.Cat)

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

exampleAction(Animal.Cat)
like image 7
Michał Kreft Avatar answered Oct 19 '22 07:10

Michał Kreft