@@ -237,16 +237,28 @@ def AddIOSBroadcastExtension(path_project_root, src_root_path_resource, team_id
237237 PrintLog ("[AddIOSBroadcastExtension] Configuring Xcode Project via Ruby..." )
238238
239239 # Find .xcodeproj
240- # Assuming UE structure: [ProjectRoot]/Intermediate/ProjectFiles/[ProjectName].xcodeproj
241- # Or checking what exists.
242240 project_name = UBSHelper .Get ().GetName_ProjectName ()
243- path_xcodeproj = path_project / "Intermediate" / "ProjectFiles" / ( project_name + "_IOS.xcodeproj" )
241+ path_xcodeproj = None # Reset
244242
245- # In UE5 Modern Xcode, it might be different structure or name?
246- # Based on logs: "UnrealGame (IOS).xcodeproj" or "AgoraExample_IOS.xcworkspace"
247- # Since we are modifying the project file that generates the workspace logic or the one used inside it.
248- # But UE often regenerates these.
249- # If modern Xcode: [ProjectRoot]/Intermediate/ProjectFiles/[ProjectName].xcodeproj matches?
243+ # Priority Check: ProjectFilesIOS (Legacy IOS specific)
244+ # This is where GenIOSProject (-XcodeProjectFiles -platforms=IOS) typically puts the project in older UE versions.
245+ # Check this BEFORE standard ProjectFiles to avoid picking up the Mac-only project.
246+ path_legacy_ios_folder = path_project / "Intermediate" / "ProjectFilesIOS"
247+ if path_legacy_ios_folder .exists ():
248+ # Try [ProjectName].xcodeproj
249+ path_temp = path_legacy_ios_folder / (project_name + ".xcodeproj" )
250+ if path_temp .exists ():
251+ path_xcodeproj = path_temp
252+
253+ # Try [ProjectName]_IOS.xcodeproj
254+ if not path_xcodeproj :
255+ path_temp = path_legacy_ios_folder / (project_name + "_IOS.xcodeproj" )
256+ if path_temp .exists ():
257+ path_xcodeproj = path_temp
258+
259+ if not path_xcodeproj :
260+ # Fallback to standard locations
261+ path_xcodeproj = path_project / "Intermediate" / "ProjectFiles" / (project_name + "_IOS.xcodeproj" )
250262
251263 # Fallback check
252264 if not path_xcodeproj .exists ():
@@ -265,13 +277,13 @@ def AddIOSBroadcastExtension(path_project_root, src_root_path_resource, team_id
265277 if path_temp .exists ():
266278 path_xcodeproj = path_temp
267279
268- # Check ProjectFilesIOS folder (Legacy IOS project structure)
280+ # Check ProjectFilesIOS folder (Legacy IOS project structure) - Redundant if Priority Check worked, but kept for safety
269281 if not path_xcodeproj .exists ():
270282 path_temp = path_project / "Intermediate" / "ProjectFilesIOS" / (project_name + "_IOS.xcodeproj" )
271283 if path_temp .exists ():
272284 path_xcodeproj = path_temp
273285
274- if path_xcodeproj .exists ():
286+ if path_xcodeproj and path_xcodeproj .exists ():
275287 # Params
276288 script_path = Path ("Tools/ios_extension_setup.rb" ).resolve ()
277289 # Targets
0 commit comments