Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

" Linker command failed with exit code 1 " in unit test?

Tags:

xcode

ios

I setup the project by Xcode 8.2.1. I upgrade to Xcode 8.3.2. I can run the project and no error. But when I run the unit test to test my app , I got this problem:

enter image description here

I have tried some ways to solve it. For example: clean the Test host

enter image description here

Or remove the derivedData and clean the app. All of them weren't work for me. I don't known the reason why I got this error. Does anyone can help me? Thanks

like image 760
Longshihua Avatar asked May 19 '17 06:05

Longshihua


2 Answers

The Host Application on my Test Target was set to None for me the error was resolved when I set that to my Project Target

You can set that in this dropdown in the General tab on your project Target:

enter image description here

like image 152
Marijn Avatar answered Sep 19 '22 00:09

Marijn


I just ran into the most unhelpful error ever while adding unit tests to an Xcode project.

The issue was that the Podfile was not updated to include a test target. I fixed it with the following steps:

First, get the name of your test target.

Next, update your Podfile with this:

  target '<YOUR_PROJECT>Tests' do
      inherit! :search_paths

      # Any pods that may be needed for testing
  end

Then, run pod install.

After that, I was able to build & run tests.

Your mileage may vary...

like image 38
CodeBender Avatar answered Sep 19 '22 00:09

CodeBender