我的自定义框架在XCode 10中能够正常工作。但是我在XCode 11 beta 3中重新构建它,然后将其集成到应用程序中,出现了以下错误:
无法在目标“x86_64-apple-ios-simulator”中找到模块“MyCustomFramework”;已找到:arm64、arm64-apple-ios。
在框架项目中,我需要在“有效架构”中进行哪些更改吗?
更新: 在我的情况下,这个框架非常小(一个类,几个方法),几乎没有使用,因此我决定摆脱它,将这些几个方法移入主项目中。
我的自定义框架在XCode 10中能够正常工作。但是我在XCode 11 beta 3中重新构建它,然后将其集成到应用程序中,出现了以下错误:
无法在目标“x86_64-apple-ios-simulator”中找到模块“MyCustomFramework”;已找到:arm64、arm64-apple-ios。
在框架项目中,我需要在“有效架构”中进行哪些更改吗?
更新: 在我的情况下,这个框架非常小(一个类,几个方法),几乎没有使用,因此我决定摆脱它,将这些几个方法移入主项目中。
YourCustomFramework
目标,并从桌面上的产品文件夹中提取框架。
2) 构建通用iOS设备的YourCustomFramework
目标,并从桌面上的产品文件夹中提取框架。
3) 将模拟器生成的框架重命名为YourCustomFramework-sim.framework
,以便稍后能够区分出来。
4) 使用lipo命令将两个二进制文件合并成一个单独的fat二进制文件(cd到您的桌面或任何您的自定义框架文件所在的位置)。$lipo -create ./YourCustomFramework-sim.framework/YourCustomFramework ./YourCustomFramework.framework/YourCustomFramework -output ./YourCustomFramework
5) 复制在上述步骤中创建的YourCustomFramework
二进制文件,并将其替换为YourCustomFramework.framework
文件夹中的二进制文件。
6) 来自文件夹
YourCustomFramework-sim.framework/Modules/YourCustomFramework.swiftmodule/
复制所有的模块并粘贴到
YourCustomFramework.framework/Modules/YourCustomFramework.swiftmodule/
这应该可以解决您的问题。
#6
项,这正是我的问题所在。 - Mando#6
。谢谢! - WukerplankSwift 5.0-5.1,Xcode 11
打开Xcode,在“你的工程”中找到“Build Settings”,选择“Build Active Architecture Only”并将其更改为Debug和Release都选“NO”。架构设置/保留在标准架构 -$(ARCHS_STANDARD),下一步很重要:
有效架构:armv7、armv7s、arm64、arm64e,在这里添加x86_64,如果需要在Debug和Release中添加i386。 (字符串:armv7、armv7s、arm64、arm64e、x86_64)
在模拟器列表中选择任何一个模拟器并构建它即可完成。
希望对您有所帮助。
架构说明:
armv64:iPhoneX、iPhone 5s-8、iPad Air — iPad Pro
armv7:iPhone3Gs-5c、iPad WIFI(第4代)
armv6:iPhone — iPhone3G
-以上是真实设备的情况
i386:32位模拟器
x86_64:64位模拟器
$(ARCHS_STANDARD) x86_64 i386
。 - agrippax86_64
和 x86_64-ios-simulator
添加到我的 SDK 和项目中,但是遇到了这个错误:Could not find module 'BlazeSdk' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios
。请问如何在 Xcode 12.2 中解决这个问题?我希望在 iPad 模拟器上运行。 - Naresh我在我的M1 MacBook上遇到了这个问题。
为了解决这个问题,我已经在我的主应用程序的Podfile文件中添加了以下几行:
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
编辑:添加此行也有助于解决运行时问题:
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
project.pbxproj
中的更改,下一个ipa又像预期的那样工作了。
我没有时间进行深入测试,看看具体哪个部分导致了问题。 - Massimo Baldrighi这是我在Podfile中所需的全部内容:
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
end
end
end
请检查您的Scheme
是否正确运行。
然后,您应该打开XCode > -您的主要目标- > 仅构建活动架构
并将“NO”设置为在所有架构上构建。
选项:
YES - 如果设置为是,则Xcode将检测连接的设备,并确定架构,并且仅在该架构上进行构建。
NO - 如果设置为否,则会在所有架构上进行构建。
x86_64
和x86_64-ios-simulator
添加到我的SDK和项目中,但是仍然出现了错误:Could not find module 'BlazeSdk' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios
。我该如何解决Xcode 12.2中的这个问题?我想在iPad模拟器上运行。 - Naresh对于使用 Xcode 12 的新 M1 Mac,我遇到了同样的问题。通过设置 Build Active Architecture Only = 'Yes'
并在构建设置中添加 VALID_ARCHS = arm64 armv7 arm64-ios-simulator
(实际上是排除 x86_64
和 x86_64-ios-simulator
架构),我成功解决了这个问题。
x86_64
和 x86_64-ios-simulator
,但是仍然无法使用,我得到了这个错误:Could not find module 'BlazeSdk' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios
。如何在 Xcode 12.2 中解决这个错误?我想在 iPad 模拟器上运行。 - Nareshx86_64
和x86_64-ios-simulator
)了吗?我的回答是针对苹果硅芯片的Mac电脑的。 - Siddharth KamariaGoogleMaps-SDK
,强制我将Excluded Architectures
设置为Any iOS Simulator SDK:arm64
(以便在模拟器中运行项目),但反过来,在我正在使用SPM的另一个库却不喜欢这样设置。 - nayooti