Hi Team,
I'm trying to set firebase flag as a launch arguments based on user choice and it is working fine in iOS 17 devices whereas not in iOS 18
Here is the sample
if true {
var arguments = ProcessInfo.processInfo.arguments
arguments.append("key")
ProcessInfo.processInfo.setValue(arguments, forKey: "arguments")
}
Launch arguments are set external to the process (such as by Xcode for various debugging configurations), and are immutable by the process itself, since it is already launched. These arguments that are set outside of the process are available to the newly launched process in the argv
array of main
, and then made available through higher-level APIs such as ProcessInfo
.
Your code snippet that sets a launch argument is using key-value coding to circumvent the read-only declaration of the arguments
property doesn't accomplish anything, because a process cannot set its own arguments to pass back to itself for next launch.
If you're looking to store a simple user preference and read it back later, something like UserDefaults
is an API that will do that for you.
— Ed Ford, DTS Engineer