如何从命令行以特定语言启动iOS Simulator? [英] How to launch iOS Simulator in specific language from command line?

查看:318
本文介绍了如何从命令行以特定语言启动iOS Simulator?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用命令行使用特定语言的iOS模拟器。所以我发现我可以使用

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

但有一些警告:

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

谢谢!

推荐答案

使用特定语言启动 iOS模拟器的唯一方法是更改​​其 .GlobalPreferences.plist <的内容/ code>文件。使用 xcrun 工具将无法正常工作,因为它会启动应用程序的参数,而不会更改模拟器本身的语言。对 .GlobalPreferences.plist 进行操作非常困难,因为它是二进制 plist 文件,因此您无法将其修改为'普通' xml 。更改其内容的最简单方法是编写简单的 Xcode命令行工具应用程序,Foundation SDK 具有所需的所有工具修改二进制 plists

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.

这篇关于如何从命令行以特定语言启动iOS Simulator?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆