ld:Framework not found for architecture i386
Asked Answered
T

2

6

I am trying to test a method in my framework, and I wrote a simple test case. But it fails to execute , and xcode gives me the error:

ld: framework not found V***ments for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I double checked that the framework is added in the embedded binary and also in build phase section.

Here is my test file:

import XCTest

@testable import MYClass


class MYClassTests: XCTestCase {

    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }

    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }

    func testExample() {
        // This is an example of a functional test case.
        // Use XCTAssert and related functions to verify your tests produce the correct results.
    }

    func testPerformanceExample() {
        // This is an example of a performance test case.
        self.measureBlock {
            // Put the code you want to measure the time of here.
        }
    }

    func testInitalization() {

    // tests pass when I comment the following lines.
//        let one = MYClass.sharedInstance
//        XCTAssertNotNil(one, "Failed to create a MYClass instance")
    }
}

When I uncomment the above two lines, I get the Framework not found error.

Also I did tried the following ways:

  • The framework is added in the Embedded binaries framework section.
  • Embedded contains swift code is set to YES,as the framework contains swift code.
  • Executable Prefix in the Packaging section is empty. (It is not set to @executable_path/Frameworks)
  • Runpath Search path in linking is set to

    $(inherited) @executable_path/Frameworks @loader_path/Frameworks

  • Also I tried clean the project and restart the xcode, and build the framework.

  • Deleted the derived data.

I am not sure what could be the issue. Any ideas?

Tautology answered 11/1, 2016 at 20:13 Comment(1)
Did you find a solution to this in the end?Combust
Z
2

This is likely because the framework isn't compiled for either the iOS simulator or for your Mac (maybe you've selected an iOS device as the build target).

If you have access to the framework target's project files, head to the Build Settings section and under Build Active Architecture Only select No.

Hope this helps!

Zoosporangium answered 2/1, 2019 at 21:38 Comment(0)
L
1

That means that V *** ments does not have a version that can be compiled for i386 phones such as iphone 5 and others.

It was useful for me to compile from the termial using this command:

xcodebuild ARCHS = arm64 -scheme <YOUR SCHEME> -workspace <NAME OF WORKSPACE> .xcworkspace / -configuration Debug build
Lift answered 1/3, 2019 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.