Kotlin 多平台应用程序的共享模块二进制文件未由 fastlane 打包

问题描述 投票:0回答:1

我们在 iOS 上使用 fastlane 进行 CI/CD 构建的问题已经有一段时间了,我现在正在尝试解决这个问题。

我们正在开发一个 Kotlin 多平台应用程序,该应用程序通过 Cocoapods 打包共享模块,该应用程序在开发过程中非常有用,甚至可以通过 XCode 存档和发布。

使用 fastlane 的 CI/CD 构建也运行良好,该应用程序已成功构建并作为临时版本发布到 App Center。但是,当我尝试在设备上打开该应用程序时,它立即崩溃。检查设备日志时我看到此错误:

ASI found [dyld] (sensitive) 'Library not loaded: @rpath/shared.framework/shared
Referenced from: <1BD25F02-DE04-35D4-BE94-37A6A7D3A268> /private/var/containers/Bundle/Application/B78CBDBE-5C0D-45E9-9CE9-E55D1A56166D/iosApp.app/iosApp
Reason: tried: '/usr/lib/swift/shared.framework/shared' (no such file, not in dyld cache), ...

我在网上搜索解决方案,但到目前为止没有任何东西指出我正确的方向,所以我希望有人可以帮助我。

Podfile:

target 'iosApp' do
  use_frameworks!
  platform :ios, '16.2'
  pod 'AppCenter'
  pod 'MaterialDesignSymbol'
  pod 'SwiftLint'
  pod 'shared', :path => '../shared'
end

快车道:

desc "Push a new beta build to App Center"
  lane :appcenter do
    # Fetch the list of all iOS devices your app is distributed to
      appcenter_fetch_devices(
        api_token: ENV["APPCENTER_API_TOKEN"],
        owner_name: ENV["APPCENTER_OWNER_NAME"],
        app_name: ENV["APPCENTER_IOS_APP_NAME"],
        destinations: "*",
        devices_file: "test-devices.txt"
      )

      # Ensure all devices are registered with Apple
      register_devices(devices_file: "test-devices.txt")

      # Provision test devices, download provisioning profile, and download signing certificate
      match(
        force_for_new_devices: true,
        type: "adhoc"
      )

      update_code_signing_settings(
        path: 'iosApp.xcodeproj',
        use_automatic_signing: false,
        team_id: ENV["sigh_com.example.myapp_adhoc_team-id"],
        profile_name: ENV["sigh_com.example.myapp_adhoc_profile-name"],
        code_sign_identity: ENV["sigh_com.example.myapp_adhoc_certificate-name"],
      )
      update_project_provisioning(
        xcodeproj: 'iosApp.xcodeproj',
        target_filter: "iosApp",
        profile: ENV["sigh_com.example.myapp_adhoc_profile-path"],
        code_signing_identity: ENV["sigh_com.example.myapp_adhoc_certificate-name"],
      )

      # Build the app
      gym(
        configuration: "Release",
        clean: true,
        include_symbols: false,
        include_bitcode: false,
      )

      # Upload the app
      appcenter_upload(
        release_notes: ENV["APPCENTER_CHANGELOG"],
      )
  end
ios cocoapods fastlane kotlin-multiplatform
1个回答
0
投票

这个答案中提供的解决方案就是解决方案。在我们的例子中,fastlane 和 Cocoapods 在构建期间没有任何问题,但是似乎缺少一些东西,通过构建虚拟框架得到了解决。

只需致电

./gradlew generateDummyFramework

在导航到 iosApp 文件夹并调用 pod install 之前从项目根目录中获取。

© www.soinside.com 2019 - 2024. All rights reserved.