linker command failed with exit code 1 (use -v to see invocation) in Swift

I encountered the same problem and my solution is as follow:

Close the current project in xcode ---> Go to your project file and open the project by clicking the .xcworkspace file. Note: not the .xodeproj file.

Hope this helps!


I got same error you have mentioned. I have just clean the project and build it. It worked!

You can clean the project in Product Tab and select clean. To build select build in product tab in Xcode.


The fact that it's a linker error should point you into the right direction. Compilation errors usually mean an error in your syntax. Linker error means that although your source files have been compiled correctly, but when the time comes to be linked with other frameworks (system frameworks, or 3rd party ones), clang cannot find them in place.

Usually, this is because a 3rd party library is missing from your system, and your project depends on it, and although it can find the header files, it cannot find the actual library file to connect to. The fact that transferring your project to other computers is giving you problems, while at your computer compiles and links correctly also strengthens the assumption that probably it's a problem with the environment you are trying to compile with and you need to install something.

To find out more about the issue, go into Xcode, go into the report navigator, and you will see logs of all the builds you have made. Check the first one (which is the last build). Scroll to the bottom, and see exactly why it didn't compile. The most common scenario is that some symbol could not be found. Check in which library this symbol belongs, then install this library to your system.

Tags:

Ios

Xcode

Swift