与现有应用程序 iOS 集成

Posted

技术标签:

【中文标题】与现有应用程序 iOS 集成【英文标题】:Integration with Existing Apps iOS 【发布时间】:2019-11-26 16:59:24 【问题描述】:

React Native 版本:0.61.5

复制步骤:

https://facebook.github.io/react-native/docs/integration-with-existing-apps

pod install

CocoaPods 在 podfile 中找不到 pod "React/Core" 的兼容版本

我的package.json 文件

"dependencies": 
"react": "^16.12.0",
"react-native": "^0.61.5"

【问题讨论】:

【参考方案1】:

我使用 npx react-native init AwesomeProject --version 0.61.5 创建了一个新项目。在此之后,我将 package.json 依赖项更改为您的配置


  "name": "***",
  "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": 
    "react": "^16.12.0",
    "react-native": "^0.61.5"
  ,
  "devDependencies": 
    "@babel/core": "^7.7.4",
    "@babel/runtime": "^7.7.4",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.7.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.57.0",
    "react-test-renderer": "16.9.0"
  ,
  "jest": 
    "preset": "react-native"
  

在 Podfile 中我有这个路径

  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

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

这是我项目的内容。在 ios 文件夹中是我的 Podfile 所在的位置 enter image description here

当我运行 Podfile 时,安装成功。 我的 yarn 版本是 1.19.1,npm 版本是 6.13.1

【讨论】:

以上是关于与现有应用程序 iOS 集成的主要内容,如果未能解决你的问题,请参考以下文章

使用 Amplify 将现有 AWS Cognito 用户池集成到 iOS 项目中

React Native 与现有应用程序的集成

React Native 与现有 Android 应用程序集成闪回

将新的 ASP.NET MVC 应用程序与现有角色集成

将 Akka 与现有 java 项目集成的示例

使用 spring-security-core 插件将 Facebook 登录 (oauth) 与现有 grails 应用程序集成