Xcodebuild 运行 不同语言的应用程序单元测试

Xcodebuild run application unit tests in different languages

此处描述了应该可以使用 xcodebuild 命令覆盖用户默认设置。

我还需要使用这种机制将语言设置为特定的语言来执行我的单元测试。知道如何做到这一点吗?当我传递 '-AppleLanguages="(en)"' 时,xcodebuild 命令总是无法启动模拟器,但出现异常:

2015-09-08 13:07:13.178 xcodebuild[82720:7171617] -[NSTaggedPointerString count]: unrecognized selector sent to instance 0x2945442d65642875
** INTERNAL ERROR: Uncaught exception **
Exception: -[NSTaggedPointerString count]: unrecognized selector sent to instance 0x2945442d65642875
Stack:
  0  0x00007fff8edfe024 __exceptionPreprocess (in CoreFoundation)
  1  0x00007fff97d8776e objc_exception_throw (in libobjc.A.dylib)
  2  0x00007fff8ee010ad -[NSObject(NSObject) doesNotRecognizeSelector:] (in CoreFoundation)
  3  0x00007fff8ed46e24 ___forwarding___ (in CoreFoundation)
  4  0x00007fff8ed46998 _CF_forwarding_prep_0 (in CoreFoundation)
  5  0x00007fff982941f2 __CopyAppleLanguages_block_invoke (in Metadata)
  6  0x00007fff98331c13 _dispatch_client_callout (in libdispatch.dylib)
  7  0x00007fff98331b26 dispatch_once_f (in libdispatch.dylib)
  8  0x00007fff982941a8 CopyAppleLanguages (in Metadata)
  9  0x00007fff98293f0e _MDAccessCopyClientPort (in Metadata)
 10  0x00007fff9829befe ___MDQueryMakeClientPortLocked_block_invoke (in Metadata)
 11  0x00007fff98336323 _dispatch_call_block_and_release (in libdispatch.dylib)
 12  0x00007fff98331c13 _dispatch_client_callout (in libdispatch.dylib)
 13  0x00007fff9833488f _dispatch_root_queue_drain (in libdispatch.dylib)
 14  0x00007fff98342fe4 _dispatch_worker_thread3 (in libdispatch.dylib)
 15  0x00007fff9a6bca9d _pthread_wqthread (in libsystem_pthread.dylib)
 16  0x00007fff9a6ba3dd start_wqthread (in libsystem_pthread.dylib)

[1]    82720 abort      xcodebuild -workspace APP.xcworkspace -scheme APP_DEBUG -sdk  test

man xcodebuild 揭示了两个选项:-testLanguage-testRegion 遵循 ISO 639-1 和 ISO 3166-1 标准