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

please help me with the error.

I got stuck badly, tried to solve the error, but did not work for me.

Help is needed....

See screenshot.

enter image description here

I get this error in the archive.

+62
ios ios8
Oct 02 '14 at 7:59
source share
22 answers

This issue occurs when the Swift level is not set to No for Release . Set to No and the problem will disappear.

  • Open the project and click on the root directory of the projects.
  • Click the build settings tab.
  • Locate the Swift Compiler - Code Generation and the optimization level, make sure Release is set to None .

EDIT

After upgrading to Xcode 6.1, these instructions caused other problems during archiving (creating for debugging / device worked fine). Setting optimization on Fastest allowed me to archive again. There are obvious problems when Swift is compiled (archiving).

Unable to archive work 6.0.1 Swift project in Xcode 6.1 / Segmentation error: 11

EDIT I ​​was unable to compile the Build Settings tab until I read this answer.

how to find build settings tab

+98
Oct. 14 '14 at 6:59
source share

This happened to me when I had two identical files, and also when I was absent. I did not know what I deleted. I clicked on the error message and just above the error, it shows you which file you have more than 1 or missing.

+33
Dec 07 '15 at 17:27
source share

You can click the Product in the navigation and select the "Clear" button; it will clear all the compilation error in your project. Then you can debug the last error.

+16
Aug 13 '15 at 1:58
source share

The link to the deleted files is saved in the build phase and why it gives this error. Delete the link there too.

Project> Goal> Build Phase

In this section you will find your deleted red files. Delete these files.

+8
Apr 13 '16 at 8:27
source share

I'm not sure if he has one solution. I recommend that you check the differences between the latest git commit and comment on the changes.

In my case, my code was

let anArray = ResultDict["ResultSet"] as [[NSDictionary : AnyObject]] for aDict : NSDictionary in anArray { let anObject = ObjectType(ObjectDict: aDict) objectList.addObject(aDict) } 

there is no warning in the line, I got the same exit error 1 then I changed it to below, which he compiled.

 let anArray = ResultDict["ResultSet"] as [[NSDictionary : AnyObject]] for aDict in anArray { let anObject = ObjectType(ObjectDict: aDict) objectList.addObject(aDict) } 
+4
Dec 19 '14 at 10:23
source share

I don't know if this is really the answer, but ...

I had the same problem. The application worked during creation / launch, but the archiving failed: "... swiftc failed with exit code 1", without any other useful message. Fortunately, when I tried to create my application with Nomad's ipa build , I got:

 The following build commands failed: CompileSwift normal arm64 /path/to/erroneous/TableViewController.swift 

So, I started commenting on sections of this file and tracked the problem until the tuple was assigned.

 // MARK: - Table Data private var tableData: [(sectionName: String, item:ListItem)] = [] private func refreshTableData() { // let labor = ("Labor", laborListItem) // DOESN'T ARCHIVE let labor = (sectionName: "Labor", item: laborListItem) // ARCHIVES tableData = [labor] tableView.reloadData() } 

Therefore, apparently, the compiler wanted the elements in thast tuple named (as defined by the tableData type) .. but only for archiving? The stupid thing is that I use the same template in other view managers, and the compiler seems to be okay with them.

For the record, my Code Generation -> Optimization Level was set to None for debugging and release.

Hope this helps someone! It took several hours to figure this out.

+3
May 15, '15 at 1:59
source share

This happened to me when I did not put a parenthesis at the end of the function call:

 let var = self.getNextPrimeNumber 

I decided:

 let var = self.getNextPrimeNumber() 
+3
Jul 22 '16 at 23:32
source share

In my case, it was caused by duplicate files with the same name in my project directory. As soon as I deleted them, the error disappeared.

+3
Aug 27 '16 at 7:47
source share

This happened to me when I used a static inline function from a fast file.

The function looks like this:

 static inline void openURLInSafari(NSString * _Nonnull urlString) { [[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];} 
+1
Jan 11 '16 at 8:56
source share

This error occurs due to missing files, so the compiler could not find the files and save the alerts. Follow these steps to rebuild the application. 1. Locate the red and invisible files in the workspace 2. Delete the link 3. Re-add the files 4. Compile

+1
May 11 '16 at 12:39 a.m.
source share

This error occurred to me after I noticed that some of my .swift files were inexplicably in the wrong directory - one level above my Xcode project directory. When I noticed this, I moved them to the main directory of the project and cleared the project, thinking that everything would be in order. However, when creating the project, I received the above error "failed with exit code 1". Just above the error message, he listed the files that I just moved, indicating that they cannot find them in the directory where they were before. In addition to the error message, the files that I moved now appear in red in the file navigation bar.

For each of the files in question, I decided: - Select a file from the list of files in the navigation bar of the Xcode file, - Click the small page icon in the right-most Xcode panel that opens the file attributes panel, - Click the small folder icon at the bottom, where he says "Location" in the file attributes panel, - Choose a new location for the file, - RESTART Xcode for the above changes to really do anything.

+1
May 20, '17 at 20:15
source share

another case that could lead to this error, which took me hours to track: a failed initializer that always returns zero.

I had an initializer that looked like this:

 init?(object: MyObject) { if object.importantProperty { // initialize } return nil } 

when I meant:

 init?(object: MyObject) { if object.importantProperty { // initialize } else { return nil } } 

initializer commit made error go away.

+1
Jun 03 '17 at 4:30
source share

I experienced this error after doing a git merge. I solved the new Xcode warnings and the project can be compiled.

Xcode 7.2.1 is used in my case.

0
Feb 17 '16 at 2:56
source share

In my opinion, the error occurred due to UIDevice.currentDevice() in ((UIDevice.currentDevice().systemVersion as NSString).floatValue >= 8.0)

After commenting it all works fine.

Xcode 7.2

0
Apr 05 '16 at 22:59
source share

Only the same thing happened to me. I was looking for a reason for a single file that caused an error, even when empty. After examining the file, I found that it had the wrong character set. When I installed it in UTF-8, the error disappeared. I think he decoded it with the wrong character set.

From this, I guess that the error simply indicates that something happened, that the compiler was not ready. Sorry this is not very useful for most people, but it can help check your character sets.

0
Jul 10 '16 at 3:37
source share

in my case, in your Target Build Setttings project, in Other Swift Flags, jsut delete String "-serialize-debuggin-options" enter image description here

0
Oct 13 '16 at 9:49
source share

In my case, the error was the result of a lack of files that were generated by Xcode. I tried the usual clean Opt + Shift + K and it did not clear all the errors. I found a message on the Apple Developer website recommending that you go to the product menu in Xcode by holding down the selection key and selecting "Clear build folder." This is apparently a more complete build, as a pop-up confirmation dialog appears.

0
Jan 10 '17 at 19:06
source share

I had a resolution very similar to RyanM , where, with an excess of pride, I tried to assign a default variable to the internal function:

Failed to compile (although SourceKit didn't crash):

 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func itemCell(_ indexPath: IndexPath = indexPath) -> UITableViewCell {//...} 

succeeds:

 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func itemCell(_ indexPath: IndexPath) -> UITableViewCell {//...} 
0
May 18 '17 at 21:46
source share

One possible reason this could happen is perhaps because you deleted the file but did not delete the links to it. This will corrupt the pbxproj file. I would have looked, right.

0
Jul 26 '17 at 3:38 on
source share

When using Core Data :
I had a Core Data object for which I subclassed NSManagedObject (using Xcode help). In addition, the object was configured to automatically generate code (see. Screenshot), therefore, for the entire time of existence, there were 2 classes in it. Just turn on the Manual / None option and it will not generate it.

enter image description here

0
Sep 01 '17 at 11:04 on
source share

check the "Development folders" checkbox in the "Full List" folder.

0
Nov 27 '17 at 12:38 on
source share

Just go to “project setup” and click “build styles”, after which you will find the goal is that you need to delete the test file, for example, my project name is “WER” so that it shows how this WER & TEST just delete it and clean ur project and run .........

-one
Jan 07 '15 at 6:16
source share



All Articles