首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装编译RingBuffer.swift失败

安装编译RingBuffer.swift失败
EN

Stack Overflow用户
提问于 2022-08-28 23:37:04
回答 2查看 355关注 0票数 0

我正在尝试实现对我的反应本机项目的RNFB。对于iOS,吊舱安装得很好。但是,当我运行npm run iOS时,我会得到以下错误和崩溃报告:

代码语言:javascript
复制
❌  /Users/[Redacted]/Documents/GitHub/[Redacted]/ios/Pods/FirebaseCoreInternal/FirebaseCore/Internal/Sources/HeartbeatLogging/RingBuffer.swift:19:35: reference to generic type 'Array' requires arguments in <...>

  case outOfBoundsPush(pushIndex: Array.Index, endIndex: Array.Index)

我找到了最近才找到的这篇文章,这似乎就是我要找的东西,但我完全不知道上面写着什么.谷歌翻译有一点帮助,但我不知道足够多,无法推断出解决方案。

老实说,我甚至不需要任何与心跳有关的消防基地。我只需要使用Firebase Analytics和Google Analytics功能。但是这个包附带了,我看不出有什么方法可以告诉它不要编译。

无论如何,我试图降级到较低版本的RNFB,我相信我是15.4.0 -> 15.0.0版本,看看新包是否是问题所在,但我仍然会遇到同样的错误。

我试着修改RingBuffer.swift文件..。但文件是只读的。

这个问题发生在其他FirebaseCore/内部文件中.

代码语言:javascript
复制
The following build commands failed:
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
    CompileSwift normal x86_64 /Users/[Redacted]/Documents/GitHub/[Redacted]/ios/Pods/FirebaseCoreInternal/[Redacted]/Internal/Sources/HeartbeatLogging/HeartbeatController.swift
    CompileSwift normal x86_64 /Users/[Redacted]/Documents/GitHub/[Redacted]/ios/Pods/FirebaseCoreInternal/FirebaseCore/Internal/Sources/HeartbeatLogging/HeartbeatsBundle.swift
    CompileSwift normal x86_64 /Users/[Redacted]/Documents/GitHub/[Redacted]/ios/Pods/FirebaseCoreInternal/FirebaseCore/Internal/Sources/HeartbeatLogging/HeartbeatsPayload.swift
    CompileSwift normal x86_64 /Users/[Redacted]/Documents/GitHub/[Redacted]/ios/Pods/FirebaseCoreInternal/FirebaseCore/Internal/Sources/HeartbeatLogging/RingBuffer.swift

这是我的package.json文件

代码语言:javascript
复制
   "main": "index.js",
   "scripts": {
      "android": "react-native run-android",
      "ios": "react-native run-ios",
      "web": "expo start --web",
      "start": "react-native start",
      "test": "jest",
      "debug-build-android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res",
      "build-android": "./android/gradlew ./android/assembleRelease"
   },
   "dependencies": {
      "@react-native-async-storage/async-storage": "^1.13.4",
      "@react-native-community/masked-view": "0.1.10",
      "@react-native-community/netinfo": "^5.9.9",
      "@react-native-firebase/app": "^15.0.0",
      "@react-navigation/bottom-tabs": "^5.11.2",
      "@react-navigation/drawer": "^5.11.4",
      "@react-navigation/native": "^5.8.10",
      "@react-navigation/stack": "^5.12.8",
      "axios": "^0.21.1",
      "expo": "~40.0.0",
      "expo-app-loading": "1.0.3",
      "expo-asset": "~8.2.1",
      "expo-blur": "~8.2.2",
      "expo-file-system": "~9.3.0",
      "expo-gl": "^9.2.0",
      "expo-keep-awake": "~8.4.0",
      "expo-screen-orientation": "^3.3.0",
      "expo-splash-screen": "~0.8.1",
      "expo-three": "^5.5.1",
      "expo-updates": "~0.4.0",
      "expo-web-browser": "~8.6.0",
      "immutability-helper": "^3.1.1",
      "lodash.throttle": "^4.1.1",
      "react": "16.13.1",
      "react-dom": "16.13.1",
      "react-native": "~0.63.4",
      "react-native-background-downloader": "^2.3.4",
      "react-native-base64": "^0.2.1",
      "react-native-elements": "3.4.1",
      "react-native-fast-image": "^8.3.4",
      "react-native-gesture-handler": "~1.8.0",
      "react-native-maps": "^0.27.1",
      "react-native-reanimated": "~1.13.0",
      "react-native-render-html": "^5.0.1",
      "react-native-safe-area-context": "^3.1.9",
      "react-native-screens": "~2.15.0",
      "react-native-toast-message": "1.4.9",
      "react-native-unimodules": "~0.12.0",
      "react-native-video": "^5.2.0",
      "react-native-view-pdf": "^0.13.2",
      "react-native-webview": "11.0.0",
      "react-native-zip-archive": "^6.0.2",
      "react-navigation-header-buttons": "^7.0.1",
      "react-redux": "^7.2.2",
      "react-three-fiber": "^5.3.21",
      "realm": "^10.4.0",
      "redux": "^4.0.5",
      "redux-devtools-extension": "^2.13.9",
      "redux-persist": "^6.0.0",
      "redux-thunk": "^2.3.0",
      "three": "0.123.0"
   },
   "devDependencies": {
      "@babel/core": "~7.9.0",
      "@testing-library/react-native": "^7.2.0",
      "@types/jest": "^26.0.19",
      "@types/lodash.throttle": "^4.1.6",
      "@types/react": "^17.0.0",
      "@types/react-native": "^0.63.40",
      "@types/react-native-background-downloader": "^2.3.3",
      "@types/react-native-base64": "^0.2.0",
      "@types/react-native-video": "^5.0.10",
      "@types/react-redux": "^7.1.14",
      "@types/react-test-renderer": "^17.0.0",
      "@types/redux-mock-store": "^1.0.3",
      "@types/three": "^0.125.3",
      "babel-jest": "^25.2.6",
      "jest": "~25.2.6",
      "jest-expo": "^42.1.0",
      "react-test-renderer": "~16.13.1",
      "redux-mock-store": "^1.5.4",
      "ts-node": "^10.2.1",
      "typescript": "^4.1.3"
   },
   "jest": {
      "preset": "jest-expo"
   },
   "private": true,
   "version": "1.0.1"
}

这是我的豆荚文件

代码语言:javascript
复制
$RNFirebaseAsStaticFramework = true #firebase requires static frameworkds
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target '[Redacted]' do
  use_unimodules!
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])
  
  # react native firebase requires frameworks...
  use_frameworks!

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  # use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })
  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
       config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
       config.build_settings['SWIFT_VERSION'] = '5.0'
      end
     end
    flipper_post_install(installer)

  end
end

Xcode版本:Version 13.4.1 (13F100)

由于匿名,一些线路已被删除。

EN

回答 2

Stack Overflow用户

发布于 2022-08-29 15:21:38

我能够通过覆盖指定的pod依赖项.swift文件并修改以下代码块来修复此编译错误

代码语言:javascript
复制
//dependency errors at this point in the file
case outOfBoundsPush(pushIndex: Array.Index, endIndex: Array.Index) 
代码语言:javascript
复制
//adding a type definition for the array fixes compilation error
case outOfBoundsPush(pushIndex: Array<Any>.Index, endIndex: Array<Any>.Index)

如果我知道在哪里报告豆荚文件的差异就好了。或者,如果有人想告诉我,为什么pod文件包装不当,让我的编译器理解?

票数 1
EN

Stack Overflow用户

发布于 2022-08-31 14:10:50

Firebase的最低支持Swift版本为5.3,因此Podfile的post_install脚本中的覆盖可能是问题所在。尝试删除或更新config.build_settings['SWIFT_VERSION'] = '5.0'

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73523004

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档