Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams Everybody wrote down his own case, damit apple, what a frustrating environment is that xcode thing yerlilbilgin Feb 8, 2021 at 18:06 Also see here . Tldr the report navigator may not give all information you need. So it might be a good idea to look into the issue navigator ... mfaani Mar 21, 2022 at 16:16 I to go this error. In my Cordova config.xml file the deployed-target was set to 11.0 - but after upgrading to Xcode 13.1 it recommend a bunch of project updates, one of which was setting the deployed-target=12.0 . After accepting the recommended 12.0 change the next compile threw the above error. I then fixed the config.xml deployed-target to 12.0, performed a clean on my project, restarted Xcode, and the error was gone. rolinger Nov 8, 2021 at 16:39

I also facing same issue in xcode 10 and tried all the solutions provided but nothing working.

Then I deleted all the files and folders of the following folder :

~/Library/Developer/Xcode/DerivedData

and it worked like a charm.

This answer worked. For copy and pastibility into terminal use this: cd ~/Library/Developer/Xcode/DerivedData && open . – tww0003 Oct 28, 2018 at 21:51 @ Dpedrinha Yes because that is of my local system. I have updated path now you will be able to find it. – Krishna Meena Jul 14, 2020 at 3:45 Didn't work. Also tried to clear build folder using command + alt + shift + k. No reaction. – atereshkov Sep 25, 2018 at 19:33 The hint was very helpful for me, even if it didn't help immediately. In the menu Product / Build for I found 'Build For', which finally solved the problem. – Ronald Hofmann Apr 19, 2021 at 9:11

This is a known issue with Swift 4.2 and Xcode 10. I found an article here that fixed it for me: https://github.com/Yummypets/YPImagePicker/issues/236

In short, go to your projects build settings, and add a user defined setting named SWIFT_ENABLE_BATCH_MODE and set its value to NO.

Previously, I tried each of the methods suggested here (rebuild, exit Xcode, clean and rebuild, purge Derived Data files). None of them worked.

Once I added the user define build setting per the article, Swift then told me the true error. In my case, it was a missing }, but it could be any number of problems.

I did find this useful. I had an error in a DispatchQueue and couldn't' see the error until I using this, the logs then pointed me to the lines inside the dispatch queue and that allowed me to then find it was just a problem with an unwrapped optional failing to get it's type. Really simple. Get rid of your dispatch queues and you may see the error without having to set SWIFT_ENABLE_BATCH_MODE – Dan M Jul 14, 2022 at 1:39

I encountered this error when I was upgrading my project from Swift 4 to 5. I first updated all my pods to their latest versions. When I built, some pods showed this error.

The following steps resolved this issue for me:

  • Removed all pods from Podfile
  • Executed pod install to remove all installed pods
  • Executed pod deintegrate to remove support for CocoaPods
  • Deleted Podfile.lock and .xcworkspace from my project so no CocoaPods anymore
  • Now my project is a pure Xcode project
  • Opened my project from the regular .xcodeproj file
  • Changed Swift Version of my project to Swift 5
  • Cleaned the project (cmd+shift+K)
  • Quitted Xcode
  • Restored all pods to my Podfile
  • Executed pod install to reintegrate CocoaPods and add my pods
  • Opened the project from the .xcworkspace file
  • Cleaned and rebuilt
  • Some old pods that were still using Swift 4.0 (SlideMenuControllerSwift in my case) were set to Swift 5.0, caused many build errors in their code. I corrected it back to Swift 4.0 by opening the Pods project and selecting its target.
  • Cleaned again, rebuilt.
  • Now I have only errors in my own project code related with difference in Swift version I made. My job now is to fix them.

    This error happened to me when I forgot to change entity Properties before creating NSManagedObject subclass. Solved by:

  • delete Entity+CoreDataClass.swift and Entity+CoreDataProperties.swift.
  • under "class" of the entity model inspector, change "module" to Current Product Module and "codegen" to Manual/None.
  • recreate the NSManagedObject.
  • I had the error Command LinkStoryboards failed with a nonzero exit code, and found that I was using a reference to a non-existent storyboard. I had recently changed the name of a storyboard file, so changing the reference from the 'old' name to the 'new' name solved it for me.
    You may not have exactly the same error as me, but an easy way to find a more detailed explanation of the error is to:

  • Show the issue navigator (while the build time error is showing)
  • Click the error:
  • Then, you should see more about your error: This led me into the correct investigation path. After reviewing all files, I noticed that some "didn't" have the Target Membership they were supposed to have (no idea why). I checked the checkbox in that file's inspector and suddenly everything is building again. Go figure. – Alex Jul 17, 2022 at 21:11

    Since this issue looks to have dozens of possible solutions and the root cause could be very vague, I'll throw my situation into the ring. Half of my pods were failing with some sort of CompileSwiftSource failure, but only on archive. I was still able to build for device and simulator just fine. I tried a lot (if not all) of the solutions suggested here with no luck. One of the pods had a slightly different error before the CompileSwiftSource error so I went to updating and trying to fix that single pod. It was the Cache library for iOS which hadn't been updated in a while. There was a fork that resolved the issue with updating to Xcode 10.2 that I was able to update to and after that, all of the other issues took care of themselves. So look for a single outlier in your pods if you're getting a bunch of them erroring out and start there.

    In my case it was about having a file named Location. after some digging I find out that it was about having two file with the same name (weird). Cause I don't, however, it's been solved by removing the file and adding another file with a different name.

    filenames are used to distinguish private declarations with the same name
    

    In my case, I used too complicated initializations inside a class extension. It suddenly broke my build.

    class MyClass { }
    extension MyClass {
    static var  var1 = "", var2 = "", var3 = "", var4 = "", ...., var20 = ""
    

    Resolved:

    class MyClass { }
        extension MyClass {
        static var var1 = "",
        static var var2 = "",
        static var var3 = ""
        static var var4 = "", ...., 
        static var var20 = ""
    

    Command CompileSwift failed with a nonzero exit code

    This error happens when you are migrating your code from Xcode 9 to Xcode 10+. It due to any class name is conflicting with existing apple classes. For Example: State, Event etc.

  • So first change the class/structure name if any existing in your code like "State" to "StateDetail"

  • If Info.plist is added in target, remove tick mark from it so it will not copy app bundle (Latest Xcode10 security reason).

  • Select Info.plist file and uncheck under "Target Membership" in right side Identity inspector
  • And build code again!!!

  • Delete Derived Data
  • Add SWIFT_ENABLE_BATCH_MODE and set its value to NO
  • Restarting Xcode and Recompiling
  • Restarting iMac and Recompiling
  • set Compilation Mode to Incremental
  • Changed build settings: SWIFT_COMPILATION_MODE = singlefile and SWIFT_OPTIMIZATION_LEVEL = "-O"
  • Nothing worked. I'm using Xcode Version 11.0 beta (11M336w).

    Finally I downloaded a fresh copy and replaced the one I had previously installed. It was the same exact version. That did the trick.

    I got this error while trying to run my unit tests in a submodule. What I have done is:

    Change the simulator => Clean the project => Build the project => Run unit tests.

    After this, my unit tests ran without any issue.

    I have the issue like that and my solution is change a little thing in Build Settings:

    SWIFT_COMPILATION_MODE = singlefile;
    SWIFT_OPTIMIZATION_LEVEL = "-O";
    

    it work to me

    So, you can have more than one storyboard, and in a multiview app I use a storyboard on every view, for modularity and that way if someone is working on another part of the app it's a lot easier to pull in those changes. On the ViewControllers there is an option to make it the initial view controller for that storyboard that loads when you call storyboard.loadInitialView() and on one storyboard that option wasn't clicked and when I clicked it it went away. – jimistephen Nov 8, 2018 at 12:24

    For me the problem was that on my Podfile I didn't put use_frameworks!. I just uncomment that line, run pod install on the terminal again. And it got fixed.

    It was commented since the app was entirely made on Objective-C. Since the app now uses Swift I had to make that change on the Podfile

    In my use case I had used the function "Refactor to Storyboard" in Xcode 13. It created the new refactored story board fine but failed to add it to bundle resources.

    So my fix was to:

  • Select the target project in Xcode Navigator
  • Choose the build phases tab
  • Expand Copy Bundled Resources to see if new storyboard was added. If not, just add it to the list and rebuild.
  • My app was having Notification Service Extension, and was using Xcode 11. The Extension doesn't have anything to do with pods.

    After 1-2 years, I have taken that project into my new m1 chip mac with Xcode 13. But the compilation was failing and showing me the error in pods.

    I tried to remove and add all pods, tried clean etc all possible available answers available on internet. Almost spent 4-5 hours to make it run, but nothing worked.

    Final Solution that worked:

    I removed, notification service extension from the project, its target etc too. And then tried to run the app. Amazingly it worked. After that, i added that extension again(by creating new extension and putting the same code again), and everything is working perfectly fine.

    I am still surprised that, was that issue with extension or with pods. But finally it worked for me.

    Hopefully, this answer might resolve someone's issue and you can save enough time.

  •