2121# IOS_SCHEME — Xcode scheme name (default: "Runner")
2222# ---------------------------------------------------------------
2323
24+ require "shellwords"
25+
2426default_platform ( :ios )
2527
2628# ------------------------------------------------------------------
@@ -62,6 +64,22 @@ def appstore_export_options(app_id)
6264 }
6365end
6466
67+ # The Flutter template ships no DEVELOPMENT_TEAM, and manual signing will not
68+ # infer one — xcodebuild fails the archive with "Signing for 'Runner' requires
69+ # a development team". Passing the team and profile here keeps them out of the
70+ # checked-in project, so the Fastfile stays project-agnostic.
71+ def appstore_xcargs ( app_id )
72+ team = ENV [ "TEAM_ID" ]
73+ UI . user_error! ( "TEAM_ID env var must be set (Apple Developer Team ID)" ) if team . nil? || team . empty?
74+
75+ [
76+ "DEVELOPMENT_TEAM=#{ team . shellescape } " ,
77+ "CODE_SIGN_STYLE=Manual" ,
78+ "PROVISIONING_PROFILE_SPECIFIER=#{ appstore_profile_name ( app_id ) . shellescape } " ,
79+ "CODE_SIGN_IDENTITY=#{ 'Apple Distribution' . shellescape } " ,
80+ ] . join ( " " )
81+ end
82+
6583platform :ios do
6684 # ------------------------------------------------------------------
6785 # Helper: Build the App Store Connect API key from environment vars
@@ -125,6 +143,7 @@ platform :ios do
125143 scheme : ios_scheme ,
126144 export_method : "app-store" ,
127145 export_options : appstore_export_options ( app_id ) ,
146+ xcargs : appstore_xcargs ( app_id ) ,
128147 output_directory : "../build/ios" ,
129148 output_name : ipa_output_name ,
130149 )
@@ -148,6 +167,7 @@ platform :ios do
148167 scheme : ios_scheme ,
149168 export_method : "app-store" ,
150169 export_options : appstore_export_options ( app_id ) ,
170+ xcargs : appstore_xcargs ( app_id ) ,
151171 output_directory : "../build/ios" ,
152172 output_name : ipa_output_name ,
153173 )
@@ -221,6 +241,7 @@ platform :ios do
221241 scheme : ios_scheme ,
222242 export_method : "app-store" ,
223243 export_options : appstore_export_options ( app_id ) ,
244+ xcargs : appstore_xcargs ( app_id ) ,
224245 output_directory : "../build/ios" ,
225246 output_name : ipa_output_name ,
226247 )
0 commit comments