当我尝试在启动的模拟器中安装我的应用程序时,如下所示:
xcrun simctl install booted /build/iphone/build/Debug-iphonesimulator/foo.app
Run Code Online (Sandbox Code Playgroud)
我得到以下结果:
An error was encountered processing the command (code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Run Code Online (Sandbox Code Playgroud)
当我检查.app中的Info.plist时,CFBundleIdentiefier就在那里并且正确.
<key>CFBundleIdentifier</key>
<string>com.bar.foo</string>
Run Code Online (Sandbox Code Playgroud)
我在Yosemite上使用xcode 6.3.2
模拟器在安装时启动.
我究竟做错了什么?
我有一个XCTest包,我可以通过使用在模拟器上运行xcode simctl.我正在使用带有以下环境变量的iPhone 6 iOS 9.1模拟器:
export SIMCTL_CHILD_TestBundleLocation="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator/Tests.xctest"
export SIMCTL_CHILD_XCInjectBundle="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator/Tests.xctest"
export SIMCTL_CHILD_XCInjectBundleInto="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator/ios_app.app/ios_app"
export SIMCTL_CHILD_XCTestConfigurationFilePath="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator/Tests.xctest/Tests-7025D700-AA6C-4343-9C7A-92F9CC3A1C42.xctestconfiguration"
export SIMCTL_CHILD_DYLD_LIBRARY_PATH="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"
export SIMCTL_CHILD_DYLD_FRAMEWORK_PATH="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"
Run Code Online (Sandbox Code Playgroud)
此时应用程序已经安装在模拟器上,模拟器正在运行,我运行:
xcrun simctl launch booted uk.co.company.ios.app -NSTreatUnknownArgumentsAsOpen NO -ApplePersistenceIgnoreState YES -XCTest All
Run Code Online (Sandbox Code Playgroud)
应用程序启动,从模拟器日志中我可以看到XCTest包加载但测试没有运行.我已经注销了它似乎停止的地方,并且有一个私有方法_checkForTestManager,更具体地说_checkManagerForDaemonStateAndConnectIfAvailable.据我所知,XCTest试图连接testmanagerd但失败.所以我尝试testmanagerd使用以下方法在模拟器上启动:
xcrun simctl spawn booted launchctl kickstart system/com.apple.testmanagerd
Run Code Online (Sandbox Code Playgroud)
但这似乎对测试运行没有影响,但我确实在模拟器日志中看到了一些额外的输出:
testmanagerd[41610]: Received new test session connection (-[XCTestManager listener:shouldAcceptNewConnection:])
testmanagerd[41610]: Initial orientation 0
testmanagerd[41610]: Test session <__NSConcreteUUID 0x7fd2bb804a00> 7025D700-AA6C-4343-9C7A-92F9CC3A1C42 requested socket (-[XCTestSession _XCT_requestSocketForSessionIdentifier:reply:])
testmanagerd[41610]: Test session <__NSConcreteUUID 0x7fd2bb804a00> 7025D700-AA6C-4343-9C7A-92F9CC3A1C42 requested socket (__57-[XCTestManager requestSocketForSessionIdentifier:reply:]_block_invoke)
testmanagerd[41610]: …Run Code Online (Sandbox Code Playgroud) 如何获取 iOS 模拟器上安装的所有应用程序的捆绑包标识符?
我想通过脚本自动卸载名为 WebDriverAgent(由 Appium 使用)的特定应用程序。
例如
xcrun simctl uninstall booted com.example.apple-samplecode.UICatalog
Run Code Online (Sandbox Code Playgroud) 我想按以下格式列出可用的 ios 模拟器(iOS 版本应取自 JSON 密钥)
{
"name": "iPhone 5s (11.4)",
"udid": "FB6B3F7F-E6CD-4F64-8EC4-6C07C86A25C8"
}
{
"name": "iPhone 6 Plus (11.4)",
"udid": "768AE0B3-F77A-4DF4-8198-74CB2D598D19"
}
...
{
"name": "iPad Air (11.4)",
"udid": "396C0E3A-7DFD-41BD-9E05-28A27E6BB4AB"
}
{
"name": "iPad Air 2 (11.4)",
"udid": "1AD4AC1A-B45B-4869-9778-B5572D4CE031"
}
...
{
"name": "iPhone 8 (13.2)",
"udid": "71E02A7B-BCBB-45D8-8638-E5381B420406"
}
{
"name": "iPhone 8 Plus (13.2)",
"udid": "D3333C55-2D0A-4999-B6D2-450C637C9248"
}
...
{
"name": "iPad (7th generation) (13.2)",
"udid": "0543121E-86DC-4BC9-933F-60AA31D219CD"
}
{
"name": "iPad Pro (11-inch) (13.2)",
"udid": "1979F272-E938-45AA-9717-A5228AF6EBF1"
}
...
Run Code Online (Sandbox Code Playgroud)
我试过这样的事情 …
我试图删除模拟器,但它处于simctl delete不会删除它的状态.我从我能想到的所有地方删除了它,但在某处保留了对它的引用.
一,上市:
$ xcrun simctl list devices | grep 3B7
Apple Watch - 38mm (3B7135C5-40A3-40FB-A130-12ACB448EE5D) (Creating) (unavailable, runtime profile not found)
接下来,我的删除尝试:
$ xcrun simctl delete 3B7135C5-40A3-40FB-A130-12ACB448EE5D
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Unable to delete device in current state: Creating
我接下来删除了设备目录,条目device_set.plist,甚至条目.default_created.plist.证明:
$ pwd; ls -l 3*
/Users/jeff/Library/Developer/CoreSimulator/Devices
ls: 3*: No such file or directory
$ grep 3B7 device_set.plist .default_created.plist ; echo Anything?
Anything?
但这没有帮助.它还在那里.
因此,如果不删除整个CoreSimulator/Devices文件夹,如何删除此损坏的设备条目?
我正在尝试使用 iOS 命令行模拟器工具创建一个应用程序预览视频,该工具生成视频,就像这样。
xcrun simctl io booted recordVideo
Run Code Online (Sandbox Code Playgroud)
但是,视频不包括音频。我已经看到视频是不可能的,除非你支持金属,我就是这样做的。
我看到了一些相互矛盾的答案,尽管提到了麦克风是否可以使用麦克风在模拟器上录制实际声音
我需要自动执行此过程,因为我有很多视频(语言/设备)需要在其中制作视频(我可以提供有关此的更多详细信息)。
我目前正在使用自动化 UI 测试来运行我的应用程序并制作视频。
我还看到了一种使用 applescript 和 quicktime player 的方法,但这似乎不适用于模拟器,而且我在使用自动化测试时会遇到问题。
或者,我希望从模拟器中单独录制我的应用程序中的音频,也许使用类似 soundflower 之类的东西。但是,我需要从命令行/脚本执行此操作。然后我必须从命令行将它们连接在一起。
我正在尝试使用 Xcode 12 捕获模拟器屏幕截图。现在,即使启用了“显示设备边框”选项(并且它在屏幕上显示边框),当我截取屏幕截图时,边框并不属于其中生成的屏幕截图。我已经尝试过模拟器上的相机按钮、“保存屏幕”菜单项、“xcrun simctl Screenshot”命令行,但它无法正常工作。
奇怪的是,昨天它工作正常,但我正在从命令行设置“defaults write com.apple.screencapture disable-shadow -bool TRUE”(以防止窗口视频捕获中的阴影).. .我不确定这是否与这个问题有关,我将其翻转回FALSE,但这似乎也没有帮助。
我还尝试过重新启动模拟器,重新启动Mac,打开/关闭“显示边框”,使用Xcode11,删除模拟器的内容......但它仍然无法正常工作。非常令人沮丧。
我可以尝试什么提示吗?谢谢。
我正在寻找一种在使用 xcrun 时设置环境的方法。我们可以通过xcrun simctl setenvXcode 7.0之前的版本来设置环境。现在我们只能使用 来查看环境xcrun simctl getenv <device> <variable name>。
我看过SIMCTL_CHILD_的参考,但我不知道如何使用它。
xcrun simctl spawn
Usage: simctl spawn [-w | --wait-for-debugger] [-a <arch> | --arch=<arch>] <device> <path to executable> [<argv 1> <argv 2> ... <argv n>]
If you want to set environment variables in the resulting environment, set them in the calling environment with a SIMCTL_CHILD_ prefix.
Run Code Online (Sandbox Code Playgroud)
我知道这是一件简单的事情,但我在这里遗漏了一小部分。
如果有人能帮助我,我真的很感激。
当我在多个模拟器上并行运行 UI 测试时,克隆的模拟器似乎对xcrun simctl.
运行时xcrun simctl list,源模拟器出现,但处于“关闭”状态:
4 Inch Snapshots - en-US (0) (3334A5D1-A4EC-41ED-AB10-55495B4BE329) (Shutdown)
当我尝试对“启动”设备运行任何命令时,它声称没有模拟器在运行:
xcrun simctl status_bar booted override --time "2007-01-09T09:41:00-05:00"
No devices are booted.
Run Code Online (Sandbox Code Playgroud)
有什么方法可以针对这些克隆模拟器吗xcrun simctl?
我正在模拟器中使用xcrun simctl. 我希望能够设置模拟器启动时使用的语言(即在一次运行时切换到法语,在另一次运行时切换到 Englash)。有没有办法做到这一点?过去可以使用-AppleLanguages模拟器的选项,但似乎不再起作用(自 Xcode 5.x 起)。
simctl ×10
xcode ×6
ios ×4
xcrun ×4
appium ×1
jq ×1
localization ×1
unit-testing ×1
xcode7 ×1
xctest ×1