You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何使用fastlane将iOS应用编译为未签名.xcarchive文件,供客户后续签名生成IPA并发布?

Great question—this is exactly the kind of workflow fastlane was built to simplify, and it’ll solve those Xcode/CocoaPods version headaches your client was running into. Let’s walk through setting up your fastlane lanes to generate an unsigned .xcarchive, plus how your client can then sign it and generate an IPA for TestFlight/App Store.

Step 1: Generate an Unsigned .xcarchive with Fastlane

You’ll use fastlane’s gym action (alias for build_app) to create an archive with no embedded provisioning profiles or signing certificates. This archive will include all compiled code and dependencies, so your client won’t need to deal with CocoaPods or Xcode version mismatches.

Add this lane to your Fastfile:

lane :build_unsigned_archive do
  # Clean build artifacts to avoid conflicts
  clean

  # Build the unsigned xcarchive
  gym(
    scheme: "YourAppScheme",
    workspace: "YourApp.xcworkspace", # Use this if you use CocoaPods; swap to `project: "YourApp.xcodeproj"` if not
    configuration: "Release",
    export_method: "app-store", # Aligns with TestFlight/App Store submission requirements
    signing_style: "manual",
    include_bitcode: true, # Required for TestFlight uploads
    include_symbols: true, # Helps with crash reporting in App Store Connect
    archive_path: "./build/YourApp.xcarchive", # Define where to save the archive
    export_options: {
      signingStyle: "manual",
      provisioningProfiles: {}, # Empty dictionary ensures no profile is embedded
      compileBitcode: true
    }
  )
end

Run it with fastlane build_unsigned_archive—you’ll get a clean, unsigned .xcarchive file in the specified build folder.

Step 2: Hand Off the Archive to Your Client

Send your client:

  • The .xcarchive file you generated
  • A note confirming their Apple Developer account has a matching bundle ID, plus the correct signing certificate and App Store provisioning profile set up
Step 3: Client’s Workflow to Sign and Generate IPA

Your client can use either fastlane (for automation) or Xcode (for a manual workflow) to sign the archive and create an IPA.

Option A: Client Uses Fastlane (Automated)

Have them add this lane to their own Fastfile, replacing placeholders with their bundle ID and provisioning profile name:

lane :sign_and_export_ipa do
  export_archive(
    archive_path: "./YourApp.xcarchive",
    export_method: "app-store",
    export_options: {
      signingStyle: "manual",
      provisioningProfiles: {
        "com.client.theirbundleid" => "Client's App Store Provisioning Profile"
      },
      compileBitcode: true,
      uploadBitcode: true
    },
    output_directory: "./build",
    output_name: "YourApp-Signed.ipa"
  )
end

Running fastlane sign_and_export_ipa will generate a signed IPA ready for upload to TestFlight or the App Store.

Option B: Client Uses Xcode (Manual)

If they prefer a GUI approach:

  1. Open Xcode and go to Window > Organizer
  2. Drag the .xcarchive file into the Organizer window to import it
  3. Select the archive, click Distribute App
  4. Choose App Store Connect > TestFlight & App Store
  5. Follow the prompts to select their signing certificate and provisioning profile, then either export the IPA or upload directly to TestFlight.
Key Tips to Avoid Issues
  • No More CocoaPods Headaches: The archive includes all compiled dependencies, so your client doesn’t need to install CocoaPods or match your Xcode version.
  • Bitcode Check: Double-check that bitcode is enabled in your project’s build settings—TestFlight requires it, and the include_bitcode: true parameter ensures it’s included in the archive.
  • Bundle ID Alignment: Confirm your project’s bundle ID matches exactly what’s in your client’s Apple Developer account, otherwise their provisioning profile won’t work.

内容的提问来源于stack exchange,提问作者Sean Saleh

火山引擎 最新活动