Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to launch iOS Simulator in specific language from command line?

I need to lauch iOS Simulator that uses specific language using command line. So I found that I can use

instruments -w <device>

and it is working great, I can set specific device. But how can I run simulator with specific language? I've tried adding

-AppleLanguages -AppleLocale

but there are some warnings:

Instruments Usage Error : Specified target process is invalid: -AppleLanguage

thanks!

like image 597
MichalMoskala Avatar asked Jul 15 '15 10:07

MichalMoskala


People also ask

How do I change the language in iOS simulator?

On the simulator, open the Settings app. Navigate to General > Language & Region > iPhone Language to select a new language.

How can I launch the iOS simulator from terminal?

Just type this command in Terminal: open -a Simulator. app to launch the most recent simulator. Type this command in Terminal to run the Simulator rigth from the its folder.

How do I open the simulator from the command-line?

Use the emulator command to start the emulator, as an alternative to running your project or starting it through the AVD Manager. Here's the basic command-line syntax for starting a virtual device from a terminal prompt: emulator -avd avd_name [ {- option [ value ]} … ]

How do I change the region in iOS simulator?

in iOS Simulator menu, go to Features -> Location -> Custom Location. There you can set the latitude and longitude and test the app accordingly. This works with mapkit and also with CLLocationManager.


1 Answers

The only way to launch iOS Simulator with specific language is to change contents of its .GlobalPreferences.plist file. Using xcrun tool will not work because it passess arguments to launched app and not changing language of simulator itself. Manipulation on .GlobalPreferences.plist is quite difficult because it is a binary plist file, so you cannot modify it as 'normal' xml. The easiest way to change its contents is to write simple Xcode Command Line Tool application, Foundation SDK has all tools needed to modify binary plists.

like image 153
MichalMoskala Avatar answered Oct 21 '22 08:10

MichalMoskala