You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级macOS Big Sur后React Native编译报Unknown type name 'namespace'错误

macOS升级Big Sur 11.6后React Native编译Flipper报错解决方法

核心报错信息

升级系统到macOS Big Sur 11.6后,原有React Native项目无法正常编译,核心报错如下:
Semantic issue: my_app/ios/Pods/Headers/Public/Flipper/CertificateUtils.h:15:1: Unknown type name 'namespace'

已尝试无效操作

  • 删除node_modules、Pods、Podfile.lock后重新安装依赖
  • 执行pod repo update后重新安装所有Pod依赖
  • 将XCode降级到12.5.1 (12E507)版本

运行环境

  • XCode版本:12.5.1 (12E507)、13.0 (13A233)
  • Cocoapod版本:1.11.2
  • Node版本:v15.1.0

相关配置文件

Podfile

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

platform :ios, '11.0'

target 'MyApp' do
  config = use_native_modules!

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

  pod 'RNCharts', :path => '../node_modules/react-native-charts-wrapper'
  pod 'react-native-voice', :path => '../node_modules/@react-native-community/voice'

  pod 'react-native-orientation-locker', :path => '../node_modules/react-native-orientation-locker'

  pod 'OpenSSL-Universal', '~>1.1.180'

  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

  target 'MyAppTests' 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_modular_headers!
  use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignal', '>= 2.9.3', '< 3.0'
end

package.json

{
  "name": "MyApp",
  "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 . --ext .js,.jsx,.ts,.tsx"
  },
  "rnpm": {
    "assets": [
      "./src/assets/fonts"
    ]
  },
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^5.9.5",
    "@react-native-community/picker": "^1.6.5",
    "@react-native-community/voice": "^1.1.9",
    "@react-navigation/drawer": "5.12.9",
    "@react-navigation/material-top-tabs": "^5.x",
    "@react-navigation/native": "5.9.8",
    "@react-navigation/native-stack": "5.0.5",
    "@react-navigation/stack": "^5.6.2",
    "@sentry/react-native": "^1.7.1",
    "@types/axios": "^0.14.0",
    "@types/geojson": "^7946.0.7",
    "@types/i18next": "^13.0.0",
    "@types/react-i18next": "^8.1.0",
    "@types/react-native-elements": "^0.18.0",
    "@types/react-native-modal": "^4.1.1",
    "@types/react-native-orientation": "^5.0.1",
    "@types/react-native-vector-icons": "^6.4.5",
    "@types/react-native-video": "^5.0.1",
    "@types/react-navigation": "^3.4.0",
    "axios": "^0.19.2",
    "form-data": "^4.0.0",
    "i18n-js": "^3.7.1",
    "i18next": "^19.7.0",
    "immutability-helper": "^3.1.1",
    "jetifier": "^1.6.6",
    "laravel-echo": "^1.8.0",
    "lodash": "^4.17.19",
    "lodash.memoize": "^4.1.2",
    "mixpanel-react-native": "^1.2.3",
    "moment": "^2.27.0",
    "pusher-js": "^6.0.3",
    "react": "16.13.1",
    "react-i18next": "^11.7.2",
    "react-native": "0.63.0",
    "react-native-animated-nav-tab-bar": "^3.1.4",
    "react-native-app-intro-slider": "^4.0.4",
    "react-native-auto-scrolling": "^2.0.0",
    "react-native-calendars": "^1.300.0",
    "react-native-chart-kit": "^6.11.0",
    "react-native-charts-wrapper": "^0.5.7",
    "react-native-collapsible": "^1.6.0",
    "react-native-country-picker-modal": "^1.11.0",
    "react-native-device-info": "^5.6.5",
    "react-native-draggable-flatlist": "^2.6.2",
    "react-native-drawer": "^2.5.1",
    "react-native-elements": "3.4.2",
    "react-native-emoji-selector": "^0.2.0",
    "react-native-flash-message": "^0.1.23",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-gifted-chat": "^0.16.3",
    "react-native-hyperlink": "^0.0.19",
    "react-native-image-pan-zoom": "^2.1.12",
    "react-native-image-picker": "^4.1.1",
    "react-native-image-progress": "^1.1.1",
    "react-native-intl-phone-input": "^1.2.21",
    "react-native-iphone-x-helper": "^1.2.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-marquee": "^0.3.2",
    "react-native-modal": "^11.5.6",
    "react-native-modalize": "^2.0.8",
    "react-native-onesignal": "^3.9.0",
    "react-native-orientation-locker": "git://github.com/wonday/react-native-orientation-locker.git#master",
    "react-native-paper": "^3.10.1",
    "react-native-phone-input": "^0.2.4",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-picker-select": "^7.0.0",
    "react-native-rate": "^1.2.4",
    "react-native-reanimated": "^1.9.0",
    "react-native-render-html": "^4.2.2",
    "react-native-safe-area-context": "3.3.0",
    "react-native-screens": "3.5.0",
    "react-native-simple-radio-button": "^2.7.4",
    "react-native-svg": "^12.1.0",
    "react-native-swift": "^1.2.3",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-tab-view": "^2.x",
    "react-native-track-player": "2.1.1",
    "react-native-tracking-transparency": "^0.1.1",
    "react-native-tts": "^3.2.0",
    "react-native-vector-icons": "^7.0.0",
    "react-native-version-check": "^3.4.2",
    "react-native-video": "^4.4.5",
    "react-native-webview": "^10.3.2",
    "react-native-zoom-lightbox": "^0.0.2",
    "react-navigation-drawer": "^2.5.0",
    "react-navigation-stack": "^2.8.2",
    "request": "^2.88.2",
    "socket.io-client": "^4.1.2",
    "string-similarity": "^4.0.2",
    "tipsi-stripe": "9.1.4",
    "ts-jest": "^26.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "@types/i18n-js": "^3.0.3",
    "@types/jest": "^26.0.13",
    "@types/lodash": "^4.14.157",
    "@types/lodash.memoize": "^4.1.6",
    "@types/react-native": "^0.62.0",
    "@types/react-native-calendars": "^1.20.8",
    "@types/react-native-charts-wrapper": "^0.5.1",
    "@types/react-native-drawer": "^2.5.4",
    "@types/react-native-phone-input": "^0.2.0",
    "@types/react-test-renderer": "^16.9.2",
    "@typescript-eslint/eslint-plugin": "^2.27.0",
    "@typescript-eslint/parser": "^2.27.0",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^26.4.2",
    "metro-react-native-babel-preset": "^0.59.0",
    "prettier": "^2.0.4",
    "react-native-localize": "^1.4.1",
    "react-navigation": "^4.4.0",
    "react-test-renderer": "16.13.1",
    "typescript": "^3.8.3"
  },
  "jest": {
    "preset": "react-native",
    "transform": {
      "^.+\\.jsx?$": "<rootDir>/node_modules/react-native/jest/preprocessor.js",
      "^.+\\.tsx?$": "ts-jest"
    },
    "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ],
    "globals": {
      "ts-jest": {
        "tsConfigFile": "tsconfig.jest.json"
      }
    }
  }
}

解决方案

按以下步骤操作即可解决该问题:

  1. 在XCode中打开项目
  2. 选中对应target,进入「Build settings」标签页
  3. 搜索「Compile Sources As」选项
  4. 将其值修改为「Objective C++」

XCode编译选项修改界面


内容的提问来源于stack exchange,提问作者Nathan GUIGUI

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.29 15:15:01