Ld: File Not Found: Linker Command Failed with Exit Code 1

ld: file not found: linker command failed with exit code 1

You might be getting this error because you renamed your project and Tests cannot be found anymore. This is easy to fix:

Solve it in Xcode like this:

  1. Select your project from the project navigator.
  2. Select [Your project's Tests] under targets
  3. Under General tab change the Host Application from the drop down
  4. Build and run.

Screenshot

This problem happened to me because I renamed my project and the tests could't find it anymore.

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

You can relink those things "Build settings->Linking->Other Linker Flags"

  1. AFNetworking
  2. MGSwipeTableCell
  3. MJRefresh
  4. iRate

Is it your project? Sometime , the code people shared in Internet could lack of some lib.

Xcode 10 Error: linker command failed with exit code 1

Open the projectname.xcworkspace if you are using cocoapods not the projectname.xcodeproj.

Alternatively, using terminal

$ open projectname.xcworkspace

Sample Image

Hope this helps.

linker command failed with exit code 1 when building Unity project in Xcode

I finally found the solution, it was linked to the UnityFramework target in Xcode. I had to remove some architectures that are not concerned by my build: i386 and x86_64. In addition, I updated the Library Search Paths to include $(SDKROOT)/usr/lib/swift.

To execute those actions automatically, you can add those lines in a PostProcessBuild file in your Unity project:

var projPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
var proj = new PBXProject();
proj.ReadFromFile(projPath);

// Update the Library Search Paths of the whole Xcode project
proj.AddBuildProperty(proj.ProjectGuid(), "LIBRARY_SEARCH_PATHS", "$(SDKROOT)/usr/lib/swift");

// Get the UnityFramework target and exclude the unwanted architectures
var unityFrameworkGuid = proj.TargetGuidByName("UnityFramework");
proj.SetBuildProperty(unityFrameworkGuid, "EXCLUDED_ARCHS", "i386");
proj.AddBuildProperty(unityFrameworkGuid, "EXCLUDED_ARCHS", "x86_64");


Related Topics



Leave a reply



Submit