diff --git a/apps/simple-camera/ios/Podfile.lock b/apps/simple-camera/ios/Podfile.lock index b36024c598..ee1e82e3c8 100644 --- a/apps/simple-camera/ios/Podfile.lock +++ b/apps/simple-camera/ios/Podfile.lock @@ -2771,7 +2771,7 @@ SPEC CHECKSUMS: React: e2dc35338068bbd299c66f043ae0d7f25de8499e React-callinvoker: 28b25d21b124c26cebaea713ba7d801b9351dc48 React-Core: 02ed7d2ffb70437bdf2aba074a13078a7b0b9ff0 - React-Core-prebuilt: b1b6e4d2fa9fd45a48500e7212eea403c30ee5c8 + React-Core-prebuilt: 0e292a9b21c7ff7a2d50d7db3141213b15222a2a React-CoreModules: b3a5a42dadcde3b5d47b325bd912eb2ced89e146 React-cxxreact: fe8f88dda044e5905e99a00f41b7a874c3908716 React-debug: 92944dc4d89f56d640e75498266cbde557a48189 diff --git a/apps/simple-camera/ios/SimpleCamera/AppDelegate.swift b/apps/simple-camera/ios/SimpleCamera/AppDelegate.swift index 66adff8335..2aef08190e 100644 --- a/apps/simple-camera/ios/SimpleCamera/AppDelegate.swift +++ b/apps/simple-camera/ios/SimpleCamera/AppDelegate.swift @@ -18,6 +18,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return args[index + 1] } + private func metroPortFromInfoPlist() -> String { + guard let port = Bundle.main.object(forInfoDictionaryKey: "RCTMetroPort") as? String, + !port.isEmpty, + !port.contains("$(") else { + return "8081" + } + return port + } + private func configureMetroFromLaunchContext() { let defaults = UserDefaults.standard let launchArgJsLocation = valueForLaunchArgument("-RCT_jsLocation") @@ -29,9 +38,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // apps/simple-camera/rn-harness.config.mjs. // Release builds still use the prebundled JS bundle in bundleURL(), so these // values do not affect release app startup. +#if DEBUG && targetEnvironment(simulator) + defaults.set(launchArgJsLocation ?? "localhost:\(metroPortFromInfoPlist())", forKey: "RCT_jsLocation") +#else if let jsLocation = launchArgJsLocation { defaults.set(jsLocation, forKey: "RCT_jsLocation") } +#endif if let packagerScheme = launchArgPackagerScheme { defaults.set(packagerScheme, forKey: "RCT_packager_scheme") diff --git a/apps/simple-camera/ios/SimpleCamera/Info.plist b/apps/simple-camera/ios/SimpleCamera/Info.plist index 781787d4a7..02921c54df 100644 --- a/apps/simple-camera/ios/SimpleCamera/Info.plist +++ b/apps/simple-camera/ios/SimpleCamera/Info.plist @@ -41,6 +41,8 @@ VisionCamera needs access to your Location to add GPS tags to captured photos. RCTNewArchEnabled + RCTMetroPort + $(RCT_METRO_PORT) UIAppFonts Ionicons.ttf