M1机器上的React Native Exclude ARM64体系结构



当使用React Native在m1机器上构建iOS模拟器时,我有一个关于排除arm64架构的问题。通过在每个带有Excluded Architectures的框中添加"arm64",我已成功地将arm64从通用项目和pod中排除。它是有效的,但每次我添加或删除一个新库并使用pod install时,我都必须手动重新进行排除。关于如何使用Podfilepost_install来解决这个问题,有一些答案,但它似乎不起作用。

我的环境:

MacBook Pro M1 Pro
React: 17.0.2
React-Native: 0.66.1
XCode 13

我的pod文件post_install:

post_install do |installer|
$RNMBGL.post_install(installer)
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer) <- this line means anything?
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
#this should exclude arm64
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
end
end
end

我指的是类似的问题:Xcode 12,为iOS模拟器构建,但链接到为iOS构建的对象文件中,用于架构"arm64">

我正在使用post_install块:

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ARCHS[sdk=iphonesimulator*]'] =  `uname -m`
end
end
flipper_post_install(installer)
end

这也比在M1上排除arm64要好一点,uname-m将注入当前的机器架构。

希望这能有所帮助。

最新更新