gpt4 book ai didi

ios - Xcode 构建错误 - 缺少所需的体系结构 i386

转载 作者:行者123 更新时间:2023-11-29 13:08:38 25 4
gpt4 key购买 nike

我知道这意味着第 3 方组件无法在模拟器上运行:

ld: warning: ignoring file /MyApp/SomeComponent.include/SomeComponent.framework/SomeComponent, missing required architecture i386 in file /MyApp/SomeComponent.include/SomeComponent.framework/SomeComponent (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SomeComponent", referenced from:
objc-class-ref in MyViewController.o
ld: symbol(s) not found for architecture i386

但是,我不想被排除在模拟器上再次运行该应用程序之外。仅当在应用程序的特定部分按下按钮时才需要第 3 方组件。我仍然希望能够在模拟器中运行应用程序的其余部分。

如果我在模拟器中运行,如何让编译器忽略它?

最佳答案

您可以使用该框架有条件地编译代码:

 #if !TARGET_IPHONE_SIMULATOR
// Code using "SomeComponent" that should be compiled for iOS device only ...
#endif

或者,您可以针对框架“弱链接”(如中所述 "Using Weakly Linked Classes in iOS"并检查可用性运行时的类:

if ([SomeComponent class]) {
// Create an instance of the class and use it.
} else {
// Alternate code path to follow when the
// class is not available.
}

关于ios - Xcode 构建错误 - 缺少所需的体系结构 i386,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17932648/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com