Skip to content
TypeScript

fix(mobile): iOS builds no longer fail on Xcode 27.2 (#19037)

nekohasekai39b1ca9088b5
diff --git a/patches/[email protected] b/patches/[email protected]
index d4aa7c4bf4b..a5ce4559f52 100644
--- a/patches/[email protected]
+++ b/patches/[email protected]
@@ -108,6 +108,72 @@ index 74544e0..92bd2f5 100644
};
export type BaseResolvedSharePayload = SharePayload & {
/**
+diff --git a/plugin/build/ios/xcode/addPbxGroup.js b/plugin/build/ios/xcode/addPbxGroup.js
+index 0867938bdc6df7aeba560cb84dc9c9156c842d95..6ff5be15de702c79cc932def1af68e4c801db48e 100644
+--- a/plugin/build/ios/xcode/addPbxGroup.js
++++ b/plugin/build/ios/xcode/addPbxGroup.js
+@@ -29,9 +29,23 @@ function addPbxGroup(xcodeProject, targetName, shareExtensionFiles, platformProj
+ }).flat();
+ // Add generated files
+ targetFiles.push(`${targetName}.entitlements`);
+- targetFiles.push(`Info.plist`);
+ const sharedFiles = Object.values(shareExtensionFiles.sharedFiles ?? []).flat().map((file)=>_path().default.join(sharedFilesPath, file)).map((file)=>_path().default.relative(_path().default.join(platformProjectRoot, targetName, 'shared'), file));
+- const { uuid: mainGroupUuid } = xcodeProject.addPbxGroup(targetFiles, targetName, targetName);
++ const { uuid: mainGroupUuid, pbxGroup: mainGroup } = xcodeProject.addPbxGroup(targetFiles, targetName, targetName);
++ // Xcode 27.2 rejects file references shared between groups. Bypass
++ // addPbxGroup's path deduplication so the widget keeps its own Info.plist.
++ const infoPlistReference = xcodeProject.generateUuid();
++ const fileReferences = xcodeProject.pbxFileReferenceSection();
++ fileReferences[infoPlistReference] = {
++ isa: 'PBXFileReference',
++ lastKnownFileType: 'text.plist.xml',
++ path: 'Info.plist',
++ sourceTree: '"<group>"'
++ };
++ fileReferences[`${infoPlistReference}_comment`] = 'Info.plist';
++ mainGroup.children.push({
++ value: infoPlistReference,
++ comment: 'Info.plist'
++ });
+ const { uuid: sharedGroupUuid } = xcodeProject.addPbxGroup(sharedFiles, 'shared', 'shared');
+ if (mainGroupUuid && sharedGroupUuid) {
+ // @ts-expect-error: TODO(@kitten): This used to be untyped, and is failing now
+diff --git a/plugin/src/ios/xcode/addPbxGroup.ts b/plugin/src/ios/xcode/addPbxGroup.ts
+index 943c263c0cf58be595bfc9745c91827da81befec..3a99a1822beb25fea3835123b9a4ad7ac3b4f8d5 100644
+--- a/plugin/src/ios/xcode/addPbxGroup.ts
++++ b/plugin/src/ios/xcode/addPbxGroup.ts
+@@ -19,14 +19,29 @@ export function addPbxGroup(
+
+ // Add generated files
+ targetFiles.push(`${targetName}.entitlements`);
+- targetFiles.push(`Info.plist`);
+
+ const sharedFiles = Object.values(shareExtensionFiles.sharedFiles ?? [])
+ .flat()
+ .map((file) => path.join(sharedFilesPath, file))
+ .map((file) => path.relative(path.join(platformProjectRoot, targetName, 'shared'), file));
+
+- const { uuid: mainGroupUuid } = xcodeProject.addPbxGroup(targetFiles, targetName, targetName);
++ const { uuid: mainGroupUuid, pbxGroup: mainGroup } = xcodeProject.addPbxGroup(
++ targetFiles,
++ targetName,
++ targetName
++ );
++ // Xcode 27.2 rejects file references shared between groups. Bypass
++ // addPbxGroup's path deduplication so the widget keeps its own Info.plist.
++ const infoPlistReference = xcodeProject.generateUuid();
++ const fileReferences = xcodeProject.pbxFileReferenceSection();
++ fileReferences[infoPlistReference] = {
++ isa: 'PBXFileReference',
++ lastKnownFileType: 'text.plist.xml',
++ path: 'Info.plist',
++ sourceTree: '"<group>"',
++ };
++ fileReferences[`${infoPlistReference}_comment`] = 'Info.plist';
++ mainGroup.children.push({ value: infoPlistReference, comment: 'Info.plist' });
+ const { uuid: sharedGroupUuid } = xcodeProject.addPbxGroup(sharedFiles, 'shared', 'shared');
+
+ if (mainGroupUuid && sharedGroupUuid) {
diff --git a/src/Sharing.types.ts b/src/Sharing.types.ts
index 18af320..3a52b70 100644
--- a/src/Sharing.types.ts
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ed0d90e7639..c308ec14167 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -182,7 +182,7 @@ patchedDependencies:
[email protected]: 2c2f8c73a23d48804c8b537b8cd73c25eb331aa47d82eaa481c6766cb81e5add
[email protected]: f0b0fd100550ed76e5c25b4d13eb7c9ff62825f8f197c53edf7bf447c50c9fb7
[email protected]: cd09b6d1744dde4efa081b5619ebcff38877d98f7502a51cab121629dece8237
- [email protected]: ad248759641ddd71b8331c09dbb3b18c8a551785f2df507533805babd3c0c124
+ [email protected]: 61a9741dc6166fdbb5baa2e489275a65dd21aa11d2c915f490a1b337a4468e76
[email protected]: 8623cb034b720c5ef2da8012c765805a7298909bd92eaf8381f64dbde41b77dd
[email protected]: afe6b2c89e1eaddfd3c90cf2723f12c9a17d513e65beff51653781486013251c
[email protected]: 9ad23a530e45d9f83cba1da8654fe16d5af8b59d5c73d5c7a7c91fd25b9be1d8
@@ -532,7 +532,7 @@ importers:
expo-sharing:
specifier: 58.0.19
- version: 58.0.19(patch_hash=ad248759641ddd71b8331c09dbb3b18c8a551785f2df507533805babd3c0c124)([email protected])([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])
+ version: 58.0.19(patch_hash=61a9741dc6166fdbb5baa2e489275a65dd21aa11d2c915f490a1b337a4468e76)([email protected])([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])
expo-splash-screen:
specifier: ~58.0.10
@@ -19837,7 +19837,7 @@ snapshots:
dependencies:
'@expo/config-plugins': 58.0.9([email protected])
'@expo/config-types': 58.0.3