React-Native iOS 仅在使用 fastlane 部署时不显示本地图片

问题描述 投票:0回答:0
System:
    OS: macOS 13.0.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 409.86 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 19.7.0 - /opt/homebrew/bin/node
    Yarn: Not Found
    npm: 9.5.0 - /opt/homebrew/bin/npm
    Watchman: 2023.03.06.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.0 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.1/14B47b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.12 - /usr/bin/javac
  npmPackages:
    u/react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0 
    react-native: 0.69.7 => 0.69.7 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

出于某种原因,当我的应用程序通过 fastlane 发布时,我的本地图像不起作用。我的资产文件夹在我的构建脚本中声明,它存在于 Xcode 中构建阶段的复制资源部分。此外,当我通过 Xcode 以发布方案构建我的应用程序时,图像加载正常,但是当使用 fastlane 发布时,它们不起作用。如果我使用 Xcode 将构建存档并推送到 appstore connect,图像也可以正常显示。

这是我的构建脚本

"react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest ./ios"

问题似乎来自fastlane,我不知道该怎么办。

下面是我的 fastfile 代码。

default_platform(:ios)

platform :ios do
  desc "Push a new beta build to TestFlight"
  lane :beta do
    increment_build_number(xcodeproj: "myApp.xcodeproj")
    get_certificates( # Create or get certificate, and install it
      output_path: "./builds" # Download certificate in the build folder (you don't need to create the folder)
    )
    get_provisioning_profile( # Create or get provisioning profile
      output_path: "./builds",  # Download provisioning profile in the build folder
      filename: "provisioning.mobileprovision" # Rename the local provisioning profile
    )
    update_project_provisioning( # Set the project provisioning profile (related in Xcode to the General > Signing Release section)
      xcodeproj: "myApp.xcodeproj",
      target_filter: "myApp", # Name of your project
      profile: "./builds/provisioning.mobileprovision",
      build_configuration: "Release"
    )
    update_project_team( # Set the right team on your project
      teamid: CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
    )
    build_app(
      workspace: "myApp.xcworkspace", 
      scheme: "myApp",    
      clean: true,
      export_method: "app-store",
      export_options: {
        provisioningProfiles: {
            CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) => CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) + " AppStore" # Value of this parameter is the name of the Provisioning Profile. By default, it will be "{bundleId} AppStore"
        }
      },
      build_path: "./builds",
      output_directory: "./builds"
      )
    upload_to_testflight
  end
end
javascript ios react-native fastlane
© www.soinside.com 2019 - 2024. All rights reserved.