xcode 16.0更新后,react-native项目在模拟器上崩溃

问题描述 投票:0回答:1

我正在开发一个运行良好的项目,但在 Xcode 16.0 之后,每次我在模拟器上打开它时,应用程序都会崩溃。

在 Xcode 15.4 版本上,我没有这个问题。

arm64 属于排除的架构。该项目较旧,使用 RN 0.63。这是我的package.json。

{
  "name": "app",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
    
  },
  "dependencies": {
    "@bankify/redux-persist-realm": "^0.1.3",
    "@react-native-community/async-storage": "^1.9.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^6.0.2",
    "@react-native-community/toolbar-android": "@^0.2.1",
    "@react-native-firebase/app": "^11.1.1",
    "@react-native-firebase/messaging": "^11.1.1",
    "@react-native-firebase/storage": "^11.1.1",
    "@react-native-picker/picker": "^2.4.8",
    "@react-navigation/bottom-tabs": "^5.8.0",
    "@react-navigation/native": "^5.7.2",
    "@react-navigation/stack": "^5.8.0",
    "add": "^2.0.6",
    "axios": "^0.19.2",
    "buffer": "^5.7.0",
    "immer": "^6.0.3",
    "moment": "^2.24.0",
    "react": "16.13.1",
    "react-native": "0.63.2",
    "react-native-audio-recorder-player": "^3.5.1",
    "react-native-camera": "^3.39.0",
    "react-native-currency-input": "^1.1.0",
    "react-native-date-picker": "^4.2.5",
    "react-native-geolocation-service": "^5.0.0",
    "react-native-gesture-handler": "^1.7.0",
    "react-native-image-picker": "^4.10.0",
    "react-native-masked-text": "^1.13.0",
    "react-native-modal": "^11.5.6",
    "react-native-permissions": "^2.2.0",
    "react-native-reanimated": "^1.10.1",
    "react-native-safe-area-context": "^3.1.1",
    "react-native-screens": "^2.9.0",
    "react-native-svg": "^12.1.0",
    "react-native-svg-charts": "^5.4.0",
    "react-native-uuid": "^1.4.9",
    "react-native-vector-icons": "^6.6.0",
    "react-native-video": "^5.2.1",
    "react-native-webview": "^11.23.1",
    "react-redux": "^7.2.0",
    "reactotron-react-native": "^5.0.0",
    "reactotron-redux": "^3.1.3",
    "reactotron-redux-saga": "^4.2.3",
    "realm": "^10.1.2",
    "redux": "^4.0.5",
    "redux-persist": "^6.0.0",
    "redux-saga": "^1.1.3",
    "rn-fetch-blob": "^0.12.0",
    "styled-components": "^5.1.0",
    "yarn": "^1.22.19"
  },
  "devDependencies": {
    "@babel/core": "^7.10.5",
    "@babel/runtime": "^7.10.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.1.0",
    "eslint": "^7.5.0",
    "jest": "^26.1.0",
    "metro-react-native-babel-preset": "^0.61.0",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

我的 Podfile 是:

$RNFirebaseAsStaticFramework = true

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'app' do
  config = use_native_modules!

  # use_modular_headers!
  use_frameworks! :linkage => :static
  
  # Convert all permission pods into static libraries
  pre_install do |installer|
    installer.pod_targets.each do |pod|
      if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
        def pod.build_type;
          # Uncomment one line depending on your CocoaPods version
          Pod::BuildType.static_library # >= 1.9
          #Pod::Target::BuildType.static_library # < 1.9
        end
      end
    end
  end

  use_react_native!(:path => config["reactNativePath"])

  permissions_path = '../node_modules/react-native-permissions/ios'

  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
  pod 'RNFBStorage', :path => '../node_modules/@react-native-firebase/storage'
  pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
  pod 'RNAudioRecorderPlayer', :path => '../node_modules/react-native-audio-recorder-player'
  # pod 'RNAudioRecorderPlayer', :path => '../node_modules/react-native-audio-recorder-player', :modular_headers => true

  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec', :modular_headers => false
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec', :modular_headers => false

  # pod 'RNSVG', :path => '../node_modules/react-native-svg'
  # pod 'react-native-webview', :path => '../node_modules/react-native-webview'
  # pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
  # pod 'react-native-video', :path => '../node_modules/react-native-video'
  # pod 'react-native-camera', :path => '../node_modules/react-native-camera'
  # pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
  # pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
  # pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

  target 'apptests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  # use_flipper!
  # use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })

  post_install do |installer|
    flipper_post_install(installer)
    #MAC M1
    installer.pods_project.build_configurations.each do |config| 
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] =  "arm64"
        end
      installer.pods_project.targets.each do |target| 
        target.build_configurations.each do |config| 
          config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
      end
    end
    #END MAC M1
  end
end

target 'app-tvOS' do
  # Pods for app-tvOS

  target 'app-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

错误是:

Error creating LLDB target at path '/Users/user/Library/Developer/Xcode/DerivedData/app/Build/Products/Debug-iphonesimulator/app.app', 
target architecture: arm64: `your text`the specified architecture 'arm64-*-*' is not compatible with 'x86_64-apple-ios-10.0.0-simulator' in '/Users/user/Library/Developer/Xcode/DerivedData/app/Build/Products/Debug-iphonesimulator/app.app/app'

我降级到了 xcode 15.4 版本,项目运行没有崩溃

ios xcode react-native ios-simulator
1个回答
0
投票

您找到解决方案了吗?我遇到了一个类似的问题,使用 RN 0.73 和 xCode 16.1

© www.soinside.com 2019 - 2024. All rights reserved.