Skip to content

Commit 4b9669a

Browse files
committed
feat: update xcode permission by command - test
1 parent c98ba67 commit 4b9669a

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

Platform/IOS.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,17 @@ def PostPackaged_UseLegencyXcodeProject(self):
299299
team_id = OneIOSCert.get_team_id
300300
provisioning_profile_specifier = OneIOSCert.get_provisioning_profile_specifier
301301

302-
UnrealProjectManager.AddIOSBroadcastExtension(path_project_root, path_ue_config_resources, team_id, provisioning_profile_specifier)
302+
# [Fix] Get App Bundle ID from Config
303+
path_ini = path_project_root / "Config" / "DefaultEngine.ini"
304+
app_bundle_id = UnrealConfigIniManager.GetConfig(path_ini, "[/Script/IOSRuntimeSettings.IOSRuntimeSettings]", "BundleIdentifier")
305+
if not app_bundle_id:
306+
# Fallback/Default attempt (e.g. from memory or args if available, otherwise warning)
307+
PrintWarn(f"Could not read BundleIdentifier from {path_ini}, check Config.")
308+
app_bundle_id = "" # Will trigger fallback in UnrealProjectManager or can be derived
309+
else:
310+
PrintLog(f"Read BundleIdentifier from Config: {app_bundle_id}")
311+
312+
UnrealProjectManager.AddIOSBroadcastExtension(path_project_root, path_ue_config_resources, team_id, provisioning_profile_specifier, app_bundle_id)
303313

304314
OneXcodeCommand = XcodeCommand()
305315

Utility/UnrealConfigIniManager.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,24 @@ def SetConfig(path_ini,section,key,val,bAppendIfNotFounded = True):
158158
with open(path_ini, 'w') as file:
159159
file.writelines(new_lines)
160160

161+
@staticmethod
162+
def GetConfig(path_ini, section, key):
163+
if not path_ini.exists():
164+
return None
165+
166+
with open(path_ini, 'r') as file:
167+
lines = file.readlines()
168+
169+
in_section = False
170+
for line in lines:
171+
line = line.strip()
172+
if line.startswith('[') and line.endswith(']'):
173+
if line == section:
174+
in_section = True
175+
else:
176+
in_section = False
177+
elif in_section and line.startswith(key + '='):
178+
return line.split('=', 1)[1]
179+
180+
return None
181+

Utility/UnrealProjectManager.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def AddMacSandboxPermissions(path_project_root):
181181
cmd_set = f"Set :{permission} true"
182182
OneXcodeCommand.PlistBuddy(cmd_set, file_entitlements)
183183

184-
def AddIOSBroadcastExtension(path_project_root, src_root_path_resource, team_id = "", provisioning_profile_specifier = ""):
184+
def AddIOSBroadcastExtension(path_project_root, src_root_path_resource, team_id = "", provisioning_profile_specifier = "", app_bundle_id = ""):
185185
# 1. Copy Source Files
186186
path_project = Path(path_project_root)
187187
src_extension_path = src_root_path_resource / "AgoraBCExtension"
@@ -299,7 +299,10 @@ def AddIOSBroadcastExtension(path_project_root, src_root_path_resource, team_id
299299
# Assuming we can get it from UBSHelper or passed args not easily available here without signature change.
300300
# Let's try to get it from ConfigParser
301301
# But ConfigParser needs uProject path.
302-
bundle_id_prefix = "io.agora.AgoraExample" # Default/Fallback
302+
bundle_id_prefix = app_bundle_id if app_bundle_id else "io.agora.AgoraExample" # Default/Fallback
303+
if not app_bundle_id:
304+
PrintWarn(f"[AddIOSBroadcastExtension] App Bundle ID not provided, using fallback: {bundle_id_prefix}")
305+
303306
# In a real scenario, retrieve this properly.
304307
extension_bundle_id = f"{bundle_id_prefix}.{extension_name}"
305308

0 commit comments

Comments
 (0)