@@ -65,6 +65,28 @@ function getSDKPath(platform) {
6565 return output . stdout . trim ( ) ;
6666}
6767
68+ const sdkVersionCache = new Map ( ) ;
69+
70+ function getSDKVersion ( platform ) {
71+ const cached = sdkVersionCache . get ( platform ) ;
72+ if ( cached ) {
73+ return cached ;
74+ }
75+
76+ const output = spawnSync ( "xcrun" , [ "--sdk" , platform , "--show-sdk-version" ] , {
77+ stdio : [ "ignore" , "pipe" , "inherit" ] ,
78+ encoding : "utf8" ,
79+ } ) ;
80+
81+ if ( output . status !== 0 ) {
82+ throw new Error ( `Failed to get SDK version for ${ platform } ` ) ;
83+ }
84+
85+ const version = output . stdout . trim ( ) ;
86+ sdkVersionCache . set ( platform , version ) ;
87+ return version ;
88+ }
89+
6890function sleep ( ms ) {
6991 return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
7092}
@@ -263,25 +285,25 @@ const sdks = {
263285 path : getSDKPath ( "iphoneos" ) ,
264286 frameworks : [ ...COMMON_FRAMEWORKS , ...IOS_FRAMEWORKS ] ,
265287 targets : {
266- arm64 : " arm64-apple-ios13.0" ,
288+ arm64 : ` arm64-apple-ios ${ getSDKVersion ( "iphoneos" ) } ` ,
267289 } ,
268290 tnsTarget : "ios-arm64" ,
269291 } ,
270292 "ios-sim" : {
271293 path : getSDKPath ( "iphonesimulator" ) ,
272294 frameworks : [ ...COMMON_FRAMEWORKS , ...IOS_FRAMEWORKS ] ,
273295 targets : {
274- x86_64 : " x86_64-apple-ios13.0 -simulator" ,
275- arm64 : " arm64-apple-ios13.0 -simulator" ,
296+ x86_64 : ` x86_64-apple-ios ${ getSDKVersion ( "iphonesimulator" ) } -simulator` ,
297+ arm64 : ` arm64-apple-ios ${ getSDKVersion ( "iphonesimulator" ) } -simulator` ,
276298 } ,
277299 tnsTarget : "ios-arm64_x86_64-simulator" ,
278300 } ,
279301 catalyst : {
280302 path : getSDKPath ( "iphoneos" ) ,
281303 frameworks : [ ...COMMON_FRAMEWORKS , ...MACOS_FRAMEWORKS , ...IOS_FRAMEWORKS ] ,
282304 targets : {
283- x86_64 : " x86_64-apple-ios13.0 -macabi" ,
284- arm64 : " arm64-apple-ios13.0 -macabi" ,
305+ x86_64 : ` x86_64-apple-ios ${ getSDKVersion ( "iphoneos" ) } -macabi` ,
306+ arm64 : ` arm64-apple-ios ${ getSDKVersion ( "iphoneos" ) } -macabi` ,
285307 } ,
286308 tnsTarget : "ios-arm64_x86_64-maccatalyst" ,
287309 } ,
0 commit comments