首页 > 解决方案 > React 本机项目在 iOS 中不起作用。如何重写 iOS 配置?

问题描述

我的项目在 android 中运行良好。当我尝试在 iOS 中构建它时,它给出了 Print: Entry, ":CFBundleIdentifier", Does Not Exist 错误。我已经尝试了很多东西,但除非我使用 react-native upgrade 升级项目,否则没有任何效果。但缺点是它也会覆盖你所有的 iOS 配置。

现在,如果我尝试构建项目,它给了我错误并要求安装 pod。 在此处输入图像描述

在 pod install 和设置 firebase 之后,它给了我与 RNSnackbar 和 netInfo 相关的新错误。podfile 中也有这两行,并且 pod install 不能解决问题

pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

pod 'RNSnackbar', :path => '../node_modules/react-native-snackbar'

与 netinfo 和snackbar 相关的新错误 在此处输入图像描述 在此处输入图像描述

播客文件

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'qfo' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for qfo
  platform :ios, '9.0'
  pod 'Firebase/Core', '~> 5.15.0'
  pod 'Firebase/Auth', '~> 5.15.0'

  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

  pod 'RNSnackbar', :path => '../node_modules/react-native-snackbar'

  target 'qfoTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'qfo-tvOS' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for qfo-tvOS

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

end

包.json

{
  "name": "qfo",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force",
    "clean:android": "cd android/ && ./gradlew clean && cd .. && react-native run-android",
    "newclear": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean --force && npm i",
    "test:watch": "jest --watch",
    "updateSnapshot": "jest --updateSnapshot",
    "coverage": "jest --coverage && open coverage/lcov-report/index.html || xdg-open coverage/lcov-report/index.html",
    "android:build": "cd android && ./gradlew assembleRelease",
    "android:install": "cd android && ./gradlew assembleRelease && ./gradlew installRelease",
    "android:hockeyapp": "cd android && ./gradlew assembleRelease && puck -submit=auto app/build/outputs/apk/app-release.apk",
    "android:devices": "$ANDROID_HOME/platform-tools/adb devices",
    "android:logcat": "$ANDROID_HOME/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V",
    "android:shake": "$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82",
    "storybook": "storybook start -p 7007",
    "lint": "standard --verbose | snazzy",
    "lintdiff": "git diff --name-only --cached --relative | grep '\\.js$' | xargs standard | snazzy",
    "fixcode": "standard --fix",
    "git-hook": "npm run lint -s && npm run test -s"
  },
  "dependencies": {
    "@react-native-community/netinfo": "^2.0.8",
    "apisauce": "^0.14.2",
    "format-json": "^1.0.3",
    "identity-obj-proxy": "^3.0.0",
    "lodash": "^4.17.11",
    "prop-types": "^15.6.1",
    "querystringify": "1.0.0",
    "ramda": "^0.25.0",
    "react": "16.6.1",
    "react-native": "0.57.7",
    "react-native-config": "^0.10.0",
    "react-native-dash": "^0.0.9",
    "react-native-firebase": "^5.2.2",
    "react-native-gesture-handler": "1.0.9",
    "react-native-indicators": "^0.13.0",
    "react-native-linear-gradient": "^2.5.3",
    "react-native-responsive-screen": "^1.2.0",
    "react-native-snackbar": "^0.5.5",
    "react-native-vector-icons": "6.1.0",
    "react-navigation": "3.0.0",
    "react-navigation-redux-helpers": "^2.0.6",
    "react-redux": "^5.0.6",
    "redux": "^4.0.0",
    "redux-saga": "^0.16.0",
    "reduxsauce": "0.7.0",
    "seamless-immutable": "^7.1.2"
  },
  "devDependencies": {
    "@storybook/addon-storyshots": "^3.4.0",
    "@storybook/addons": "^3.4.0",
    "@storybook/channels": "^3.4.0",
    "@storybook/react-native": "^3.4.0",
    "babel-core": "6.26.0",
    "babel-eslint": "7.1.1",
    "babel-jest": "24.1.0",
    "babel-plugin-ignite-ignore-reactotron": "^0.3.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react-native": "^3.0.2",
    "enzyme": "^3.2.0",
    "enzyme-adapter-react-16": "^1.1.0",
    "ignite-andross": "^3.0.4",
    "ignite-standard": "1.0.0",
    "ignite-vector-icons": "1.1.1",
    "jest": "24.1.0",
    "metro-react-native-babel-preset": "0.51.1",
    "mockery": "^2.1.0",
    "react-devtools-core": "3.4.3",
    "react-dom": "16.3.0",
    "react-test-renderer": "16.6.1",
    "reactotron-react-native": "^2.1.0",
    "reactotron-redux": "^2.1.0",
    "reactotron-redux-saga": "^2.1.0",
    "snazzy": "^8.0.0",
    "standard": "10.0.2"
  },
  "jest": {
    "testMatch": [
      "<rootDir>/Tests/**/*.js",
      "**/?(*.)(spec|test).js?(x)"
    ],
    "testPathIgnorePatterns": [
      "/node_modules/",
      "<rootDir>/Tests/Setup.js"
    ],
    "moduleNameMapper": {
      "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "identity-obj-proxy"
    },
    "transform": {
      "^.+\\.(js)$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
    },
    "setupFiles": [
      "<rootDir>/Tests/Setup"
    ],
    "preset": "react-native"
  },
  "config": {},
  "standard": {
    "parser": "babel-eslint",
    "globals": [
      "describe",
      "test",
      "jest",
      "expect",
      "fetch",
      "navigator",
      "__DEV__",
      "XMLHttpRequest",
      "FormData",
      "React$Element"
    ]
  }
}

我该如何解决?提前致谢。

标签: react-nativecocoapodsreact-native-ios

解决方案


推荐阅读