React-Native iOS仅在使用fastlane部署时才显示本地镜像

kh212irz  于 2023-04-12  发布在  React
关注(0)|答案(1)|浏览(187)
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发布时,我的本地镜像不起作用。我的assets文件夹在我的构建脚本中声明,并且它存在于Xcode中Build Phases的Copy Resources部分。此外,当我通过Xcode镜像以发布模式构建应用时,加载正常,但是当使用fastlane发布时,它们不起作用。如果我使用Xcode存档并将构建推送到appstore connect,图像也被精细地显示。
这是我的构建脚本

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

问题似乎来自快车道,我不知道该怎么办。
下面是我的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
nfzehxib

nfzehxib1#

最终修复了它。与我的ios/assets文件夹链接到项目有关。不确定这些步骤中的哪些步骤修复了问题,但我在重启笔记本电脑后按时间顺序做了以下工作。
1.将构建脚本更改为:"react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest ios" .
1.删除Xcode中的ios/assets文件夹(选中将项目移动到垃圾桶)。
1.运行构建脚本,重新生成ios/assets文件夹。
1.将ios/assets文件夹拖动到Xcode链接文件夹中,必要时选择复制文件。
1.清理iOS构建文件夹。
1.通过fastlane部署项目。
我相信修复来自删除资产文件夹和重新链接,但任何有更多专业知识的人都可以证实。

相关问题