Ios ld:未找到架构i386的框架
我正在尝试在我的框架中测试一个方法,并编写了一个简单的测试用例。但它无法执行,xcode给了我一个错误:Ios ld:未找到架构i386的框架,ios,swift,xcode7.2,xctestcase,Ios,Swift,Xcode7.2,Xctestcase,我正在尝试在我的框架中测试一个方法,并编写了一个简单的测试用例。但它无法执行,xcode给了我一个错误: ld: framework not found V***ments for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) 我仔细检查了该框架是否添加到嵌入式二进制文件中,以及是否添加到构建阶段部分 这是我的测试文件: import XCTes
ld: framework not found V***ments for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我仔细检查了该框架是否添加到嵌入式二进制文件中,以及是否添加到构建阶段部分
这是我的测试文件:
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")
}
}
当我取消对上述两行的注释时,我得到了frameworknotfound错误
我也尝试了以下方法:
- 框架添加到嵌入式二进制文件框架部分
- 嵌入式包含swift代码设置为
,因为框架包含swift代码YES
- 打包部分中的可执行前缀为空。(未设置为@executable\u path/Frameworks)
- 链接中的运行路径搜索路径设置为 $(继承) @可执行路径/框架 @加载程序路径/框架
- 我还尝试清理项目,重新启动xcode,并构建框架
- 删除了派生数据
我不确定会是什么问题。有什么想法吗?这可能是因为该框架既不是为iOS模拟器编译的,也不是为Mac编译的(可能是您选择了iOS设备作为构建目标) 如果您有权访问框架目标的项目文件,请转到
构建设置
部分,然后在仅构建活动体系结构
下选择否
希望这有帮助 这意味着V***ments没有一个可以为i386手机(如iphone5等)编译的版本 对我来说,使用以下命令从术语中编译是很有用的:
xcodebuild ARCHS = arm64 -scheme <YOUR SCHEME> -workspace <NAME OF WORKSPACE> .xcworkspace / -configuration Debug build
xcodebuild ARCHS=arm64-scheme-workspace.xcworkspace/-configuration-Debug-build
您最终找到了解决方案吗?