【问题标题】:eas build for ios error: The following Swift pods cannot yet be integrated as static libraries:eas build for ios 错误:以下 Swift pod 还不能集成为静态库:
【发布时间】:2023-02-11 05:13:28
【问题描述】:

我正在为基于 expo 的 React Native 应用程序使用 eas build。我无法为 ios 构建并在安装 pod 期间不断收到错误,并显示以下错误日志:

106 [!] 以下 Swift pod 还不能集成为静态库: 107 Swift pod FirebaseCoreInternal 依赖于 GoogleUtilities,它没有定义模块。要选择那些生成模块映射的目标(当构建为静态库时,这是从 Swift 导入它们所必需的),您可以在 Podfile 中全局设置 use_modular_headers!,或为特定依赖项指定 :modular_headers => true。 108 错误:未知错误。有关详细信息,请参阅日志。

我在 node_modules/react-native/template/ios/Podfile 中搜索了很多我在编辑 Podfile 时使用的与 stackoverflow 相关的问题。 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, '12.4'
install! 'cocoapods', :deterministic_uuids => false

# added only these 5 lines to the Podfile
use_frameworks! :linkage => :static
pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
use_modular_headers!


target 'HelloWorld' do
  config = use_native_modules!


  # Flags change depending on the env values.
  flags = get_default_flags()
  
  ...

问题:

  1. 添加的 5 行是否在代码中的适当位置?我试过将它们添加到

  2. 我是否必须在 Podfile 之外的其他地方编辑代码?如果是,在哪里以及什么代码。

    现在已经与这个问题斗争了长达 2 周。任何帮助将是最受欢迎的。

    谢谢

【问题讨论】:

    标签: ios swift react-native expo eas


    【解决方案1】:

    搜索和搜索,混合和匹配,然后反复试验。以下对我有用。

    在 node_modules/react-native/template/ios/Podfile 中,我将 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, '13.0'
    install! 'cocoapods', :deterministic_uuids => false
    
    target 'HelloWorld' do
      config = use_native_modules!
    
      # Flags change depending on the env values.
      flags = get_default_flags()
    
      pod 'Firebase', :modular_headers => true
      pod 'FirebaseCore', :modular_headers => true
      pod 'GoogleUtilities', :modular_headers => true
      $RNFirebaseAsStaticFramework = true
    
      use_react_native!(
        :path => config[:reactNativePath],
        # Hermes is now enabled by default. Disable by setting this flag to false.
        # Upcoming versions of React Native may rely on get_default_flags(), but
        # we make it explicit here to aid in the React Native upgrade process.
        # :hermes_enabled => true,
        :hermes_enabled => flags[:hermes_enabled],
        :fabric_enabled => flags[:fabric_enabled],
        # Enables Flipper.
        #
        # Note that if you have use_frameworks! enabled, Flipper will not work and
        # you should disable the next line.
        # :flipper_configuration => FlipperConfiguration.enabled,
        # An absolute path to your application root.
        :app_path => "#{Pod::Config.instance.installation_root}/.."
      )
    
      target 'HelloWorldTests' do
        inherit! :complete
        # Pods for testing
      end
    
      use_flipper!()
    
      post_install do |installer|
        react_native_post_install(installer)
        __apply_Xcode_12_5_M1_post_install_workaround(installer)
      end
    end
    

    然后还加了插件到我的 app.config.js(如果您使用的是 app.json,则类似)。

    module.exports = {
      expo: {
        name: "appName",
        slug: "appName",
        scheme: "appName",
        version: "1.0.0",
        orientation: "portrait",
        icon: "./assets/icon_1.png",
        userInterfaceStyle: "light",
        splash: {
          image: "./assets/entry_page.png",
          resizeMode: "contain",
          backgroundColor: "#ffffff"
        },
        updates: {
          fallbackToCacheTimeout: 0
        },
        assetBundlePatterns: [
          "**/*"
        ],
        ios: {
          supportsTablet: true,
          bundleIdentifier: "com.myaooo.appName"
        },
        android: {
          adaptiveIcon: {
            foregroundImage: "./assets/icon_1.png",
            backgroundColor: "#FFFFFF"
          },
          package: "com.myaooo.appName",
          versionCode: 5,
          config: {
            googleMaps: {
              apiKey: process.env.PLACES_API_KEY
            }
          }
        },
        web: {
          favicon: "./assets/favicon.png"
        },
        extra: {
          eas: {
            placesApiKey: process.env.PLACES_API_KEY,
            youtTubeApiKey: process.env.YOUTUBE_API_KEY,
            webApiKey: process.env.WEB_API_KEY,
            firebaseApiKey: process.env.apiKey,
            expoGoogleClientId: process.env.EXPO_GO_GOOGLE_CONSOLE_client_id,
            expoAndroidId: process.env.EXPO_GO_GOOGLE_CONSOLE_androidClientId,
            expoIosId: process.env.EXPO_GO_GOOGLE_CONSOLE_iosClientId,
            clientID: process.env.WEB_clientId,
            expoGoogleClientSecret: process.env.EXPO_GO_GOOGLE_CONSOLE_client_secret
          }
        },
        plugins: [
          [
            "expo-build-properties",
            {
            android: { 
              compileSdkVersion:31,
              targetSdkVersion:31,
              buildToolsVersion:"31.0.0"
              },
            ios: {
              deploymentTarget:"13.0",
              useFrameworks: "static"
              }
            }
          ]
        ]
      }
    }
    
    

    本质上,您必须对 podfile(添加模块化标头)以及 app.json / app.config.js(添加插件)文件进行修改。

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题,但我无法修改 node_modules 文件夹中的文件。最终,我found this解决了这个问题。

      【讨论】:

        猜你喜欢
        • 2021-10-19
        • 2022-06-20
        • 2016-06-05
        • 2022-10-17
        • 2023-02-07
        • 2016-01-22
        • 2015-09-17
        • 2018-10-30
        • 2021-03-07
        相关资源
        最近更新 更多