pro*_*_98 7 xcode ios react-native apple-m1
将react-native包从0.63.4升级到0.64.4后,在模拟器和设备上构建和运行应用程序时,我在Xcode(在MacBook Pro M1上)中遇到以下错误:
我尝试过使用或不使用脚蹼,但没有任何帮助。还手动将 CoreFoundation 和 Foundation Framework 添加到项目中,并在启用和不启用 Rosetta 的情况下运行 Xcode。
这是我当前的 PodFile:
source 'https://github.com/CocoaPods/Specs.git'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.0'
target 'MyApp' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
#use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
end
Run Code Online (Sandbox Code Playgroud)
Wed*_*tin 11
对我来说是Flipper。我没有在旧项目中使用它,它在我的新项目中自动启用。如果您的项目不需要,只需注释掉 Podfile 中的行即可。
# :flipper_configuration => FlipperConfiguration.enabled,
Run Code Online (Sandbox Code Playgroud)
pro*_*_98 -2
我的解决方案是使用您想要升级到的版本创建一个新的、干净的项目。然后执行以下步骤:
另外还有一个用于重建 .xcworkspace 的不错的 npm 脚本(将“[PRJECT_NAME]”替换为您的 .xcworkspace 名称):
"renew-pods-m1": "cd ios; rm -rf ~/Library/Caches/CocoaPods; rm -rf Pods; rm -rf [PROJECT_NAME].xcworkspace; rm -rf ~/Library/Developer/Xcode/DerivedData/*; pod deintegrate; pod setup; arch -x86_64 pod install;"
Run Code Online (Sandbox Code Playgroud)
注意:查看您的 PodFile。也许您需要更改 use_react_native 实现并添加 post_install 脚本
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
Run Code Online (Sandbox Code Playgroud)
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
#use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8315 次 |
| 最近记录: |