【问题标题】:"Your Podfile requires that the plugin `cocoapods-patch` be installed" after XCode 13 updateXCode 13 更新后“您的 Podfile 需要安装插件 `cocoapods-patch`”
【发布时间】:2022-08-15 18:07:02
【问题描述】:

当我在 React Native 项目中运行 cd iospod install 时,获得了带有 MacOS Monterey 12.2.1 (21D62) 和 XCode 版本 13.4.1 (13F100) 的新 M1 Macbook 后,我得到:

[!] 您的 Podfile 需要安装插件 cocoapods-patch。请安装它并再次尝试安装。

我已经在寻找解决方案。

全局安装 \'cocoapods-patch\' 没有任何区别。

自去年以来,“cocoapods-patch”没有新的更新。

显然可以强制 XCode 12 在蒙特雷工作,这应该可以工作,但这不是一个合适的解决方案。最终我需要更新到 XCode 13。

有任何想法吗?谢谢你。

播客文件:

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

# source \'https://github.com/CocoaPods/Specs.git\'
source \'https://cdn.cocoapods.org/\'

platform :ios, \'12.1.0\'
plugin \'cocoapods-patch\'

target \'MyProject\' do
  use_unimodules!
  config = use_native_modules!
  pod \'Google-Mobile-Ads-SDK\'
  pod \'GoogleToolboxForMac/NSString+HTML\', \'2.3.0\'
  pod \'Mantle\', \'2.1.6\'
  pod \'tealium-swift\', \'2.6.0\' # all modules
  pod \"tealium-react-native-swift\", :path => \'../node_modules/tealium-react-native/tealium-react-native-swift.podspec\'

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true
  )

  permissions_path = \'../node_modules/react-native-permissions/ios\'
  pod \'Permission-AppTrackingTransparency\', :path => \"#{permissions_path}/AppTrackingTransparency\"

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  # use_flipper!()

  #   post_install do |installer|
  #     react_native_post_install(installer)
  #   end
  # end
  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    # Apple Silicon builds require a library path tweak for Swift library discovery or \"symbol not found\" for swift things
    installer.aggregate_targets.each do |aggregate_target| 
      aggregate_target.user_project.native_targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings[\'LIBRARY_SEARCH_PATHS\'] = [\'$(SDKROOT)/usr/lib/swift\', \'$(inherited)\']
          config.build_settings.delete \'IPHONEOS_DEPLOYMENT_TARGET\'
        end
      end
      aggregate_target.user_project.save
    end

    # Flipper requires a crude patch to bump up iOS deployment target, or \"error: thread-local storage is not supported for the current target\"
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings[\'IPHONEOS_DEPLOYMENT_TARGET\'] = \'11.0\'
       end
    end

    # ...but if you bump iOS deployment target, Flipper barfs again \"Time.h:52:17: error: typedef redefinition with different types\"
    # We need to make one crude patch to RCT-Folly - set `__IPHONE_10_0` to our iOS target + 1
    # https://github.com/facebook/flipper/issues/834 - 84 comments and still going...
    `sed -i -e  $\'s/__IPHONE_10_0/__IPHONE_12_0/\' #{installer.sandbox.root}/RCT-Folly/folly/portability/Time.h`
  end
end

在 \'pod install --verbose\' 之后登录:

Installing unimodules:
 expo-constants@11.0.2 from ../node_modules/expo-constants/ios
 expo-file-system@11.1.3 from ../node_modules/expo-file-system/ios
 expo-image-loader@2.2.0 from ../node_modules/expo-image-loader/ios
 expo-in-app-purchases@11.0.1 from ../node_modules/expo-in-app-purchases/ios
 expo-modules-core@0.2.0 from ../node_modules/expo-modules-core/ios
 unimodules-app-loader@2.2.0 from ../node_modules/unimodules-app-loader/ios
 unimodules-core@7.1.2 from ../node_modules/@unimodules/core/ios
 unimodules-react-native-adapter@6.3.9 from ../node_modules/@unimodules/react-native-adapter/ios
 unimodules-task-manager-interface@6.2.0 from ../node_modules/unimodules-task-manager-interface/ios

  $ /Users/ramiro/.nvm/versions/node/v14.15.0/bin/node -e try {console.log(require(\'@react-native-community/cli\').bin);} catch (e)
  {console.log(require(\'react-native/cli\').bin);}
  /Users/ramiro/mobile-darwin/node_modules/@react-native-community/cli/build/bin.js
RNFBAnalytics: Using default Firebase/Analytics with Ad Ids. May require App Tracking Transparency. Not allowed for Kids apps.
RNFBAnalytics: You may set variable `$RNFirebaseAnalyticsWithoutAdIdSupport=true` in Podfile to use analytics without ad ids.
Using firebase.json from \'/Users/ramiro/mobile-darwin/firebase.json\'
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Adding a custom script phase for Pod RNFBCrashlytics: [RNFB] Crashlytics Configuration
react-native-appsflyer: Using default AppsFlyerFramework.You may require App Tracking Transparency. Not allowed for Kids apps.
react-native-appsflyer: You may set variable `$RNAppsFlyerStrictMode=true` in Podfile to use strict mode for kids apps.
Auto-linking React Native modules for target `NewEspresso`: BVLinearGradient, RNBootSplash, RNCAsyncStorage, RNCMaskedView, RNColorMatrixImageFilters, RNDeviceInfo, RNFBAnalytics, RNFBApp, RNFBCrashlytics, RNFBFirestore, RNFBMessaging, RNFBPerf, RNFBRemoteConfig, RNFS, RNGestureHandler, RNKeychain, RNLocalize, RNPermissions, RNSVG, RNScreens, RNSentry, RNShare, RNSharedElement, RNVectorIcons, apptentive-react-native, react-native-ad-manager, react-native-appsflyer, react-native-background-downloader, react-native-background-timer, react-native-blur, react-native-mmkv-storage, react-native-netinfo, react-native-pager-view, react-native-photo-manipulator, react-native-safe-area-context, react-native-slider, react-native-track-player, react-native-view-shot, react-native-webview, and tealium-react-native
  Preparing
[!] Your Podfile requires that the plugin `cocoapods-patch` be installed. Please install it and try installation again.

/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:722:in `block in ensure_plugins_are_installed!\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:720:in `each\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:720:in `ensure_plugins_are_installed!\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:225:in `block in prepare\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:149:in `message\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:222:in `prepare\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:160:in `install!\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in `run\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/bin/pod:25:in `load\'
/opt/homebrew/Cellar/cocoapods/1.11.3/libexec/bin/pod:25:in `<main>\'

[!] use_native_modules! skipped the react-native dependency \'react-native-economist\'. No podspec file was found.
    - Check to see if there is an updated version that contains the necessary podspec file
    - Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good example of a package.json driven podspec. See
    https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec
    - If necessary, you can disable autolinking for the dependency and link it manually. See
    https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library

我想补充一点,当我执行pod 时,我没有收到patch 命令,就像根本没有安装cocoapods-patch。但我已经做了很多次sudo gem install cocoapods-patch

  • 请分享您的播客文件。你也试过instructions 来安装 cocoapods-patch 吗?
  • Podfile 已添加到我的问题中。是的,cocoapods-patch 已经安装并且可以工作了。开始使用 XCode 13(新的 Monterey Mac)时它停止工作
  • 也许问题出在其他地方。您还会分享完整的安装错误日志/堆栈跟踪吗?
  • 刚刚又更新了帖子。
  • 暂时没有想法。也许试试pod updatepod install --repo-update?如果我想到别的,会告诉你的。 plugin \'cocoapods-patch\' 似乎在 xcode13.4.1 上为我们工作

标签: ios xcode react-native cocoapods


【解决方案1】:

经过以下步骤后,该问题得到修复:

sudo gem uninstall cocoapods cocoapods-patch

sudo brew uninstall cocoapods cocoapods-patch

sudo brew install cocoapods cocoapods-patch

基本上卸载所有东西并用brew重新安装。看来我已经安装了带有 gem 的 cocoapods 和带有 brew 的 cocoapods-patch 或其他方式。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-10-20
    • 2015-12-08
    • 2015-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-18
    • 2018-03-24
    相关资源
    最近更新 更多