简介 可用通过xcrun simctl 和ios-sim来查看和管理iOS模拟器 xcrun simctl是Xcode自带的,ios-sim可用通过以下指令安装 npm install ios-sim 关闭指定udid的模拟器 xcrun simctl shutdown E66A26DD-2063-4FBE-9AE8-9E82C4A251FF 6. 关闭所有打开的模拟器 xcrun simctl shutdown all 7.重置模拟器(清除模拟器的数据和设置) xcrun simctl erase E66A26DD-2063-4FBE-9AE8- xcrun simctl install booted <app路径> 9.启动指定的app xcrun simctl launch <device> <bundle identifier> 如果只有一个设备时可以使用指令 xcrun simctl launch booted <bundle identifier>
但 Xcode 11.4 之后可以通过simctl命令在模拟器上进行测试。 使用命令行 Xcode 命令行工具允许从终端上使用模拟器:启动模拟器,触发通用链接等。 查看帮助 xcrun simctl push --help Send a simulated push notification Usage: simctl push <device> [<bundle 还可以使用xcrun simctl list devices | grep Booted查看已经启动的模拟器。 xcrun simctl list devices | grep Booted iPhone 11 Pro Max (97AE0B1F-4C63-4B02-906B-8B2CF9E3F4B0) 案例 xcrun simctl push booted developer.yf.TestUIKit /Users/yangfan/Desktop/playload.json playload.json
截图 xcrun simctl io booted screenshot /pictures/test.png 录屏命令 xcrun simctl io booted recordVideo /videos xcrun simctl boot $UUIDxcrun instruments -w "iPhone 8(11.2)" 关闭模拟器 xcrun simctl shutdown $UUID 重置模拟器 xcrun simctl delete unavailable 安装指定app xcrun simctl install booted <app路径>ios-sim launch /Users/nali simctl launch booted <bundle identifier>#多设备时xcrun simctl launch <device> <bundle identifier> 关闭已经打开的应用 > 卸载指定应用 xcrun simctl uninstall booted <bundle identifer>#多设备时xcrun simctl uninstall <device> <bundle
libimobiledevice:使用本机协议与 iOS 真机设备上的服务进行通信的开源包 ideviceinstaller:用于管理 iOS 设备上的应用程序和应用程序存档的命令行应用程序 xcrun simctl ideviceinstaller -u [udid] --install [xxx.ipa]:给指定连接的设备安装应用 ideviceinstaller --uninstall [bundle id]:卸载指定应用 xcrun simctl 常用命令 xcrun simctl list:查看设备状态 xcrun simctl boot [UDID]:启动指定设备名称的模拟器 xcrun simctl shutdown [UDID]:关闭指定设备名称的模拟器 xcrun simctl install <uuid> <app路径>:安装APP xcrun simctl launch <device> <bundle identifier>:启动指定APP
4、在模拟器中触发通知 使用Xcode将app在模拟器中运行 打开终端 cd到推送负载(payload.apns)文件的所在文件夹 执行命令 xcrun simctl push <device-identifier > <your-bundle-id> notificationpayload.apns 示例: xcrun simctl push BBF604BB-2CE2-4949-B706-88DE5A1B5678
Workaround: Xcode simctl status_bar is still broken for iOS 17 simulators[10] jesse squires[11] simctl 不幸的是,在 iOS 17 模拟器上,simctl status_bar 的功能遭遇了障碍,传统的方法无法再被应用。在这篇文章中,jesse squires 分享了他为解决这一问题所找到的临时方案。 Swift app: https://t.ly/EDXwf [9] Pol Piella: https://twitter.com/polpielladev [10] Workaround: Xcode simctl
HelloWorld.app/HelloWorld: Mach-O 64-bit executable arm64 模拟器 iOS模拟器除了可以在Xcode启动,也可以通过命令行进行管理,如: xcrun simctl help 查看具体帮助: $ xcrun simctl help install Install an app on a device. Usage: simctl install <device> <path> 例如,我们要想在模拟器中启动上节编译好的HelloWorld.app,可以用以下命令: # 查看当前设备列表,选择一个设备UDID xcrun simctl list devices # 打开并启动设备 open -a Simulator --args -CurrentDeviceUDID $UDID # 在启动的设备中安装我们的应用 ,注意需要app支持x86架构 xcrun simctl install booted /path/to/HelloWorld.app 关于simctl的更多使用示例可以参考这篇文章。
3.通过指令安装到模拟器上: $ xcrun simctl install booted /path/to/xxx.app 备注:/path/to/xxx.app 这个是.app包的绝对路径,可以输入前面的指令 4.卸载app的指令: $ xcrun simctl uninstall booted xxx.app xxx.app就是包名,这里不需要路径,如:TestApp.app 三、xcode-select
addItemWithTitle:@"退出" action:@selector(terminate:) keyEquivalent:@"q"]; 效果如下 4、获取模拟器 在mac的终端执行 xcrun simctl 在代码中,我们不能使用这样的命令来获取,因为xcrun实际上相当于是快捷方式,必现找到xcode路径,找到simctl的实际path NSTask *task = [NSTask new ]; NSString *path = [NSString stringWithFormat:@"%@/Contents/Developer/usr/bin/simctl",xcodeURL.path
run-ios 指定模拟器设备需要添加--simulator参数,默认iPhone 6 react-native run-ios --simulator "iPhone 7" 可以运行命令xcrun simctl
simctl 命令是 xcrun 的一套自命令,提供一系列用来控制 iOS 模拟器的命令。 列举当前已经启动的模拟器 xcrun simctl list devices | grep booted 启动模拟器 xcrun simctl boot XXXXX 关闭模拟器 xcrun simctl shutdown XXXXX 设置模拟器权限 xcrun simctl privacy XXX grant location-always xx.xx.xxx 安装 App xcrun simctl install {} {}'.format(uuid, app_path) 运行指定 App xcrun simctl launch {} {}'.format(uuid, bundle_id) 结束指定 App xcrun simctl terminate {} {}'.format(uuid, bundle_id) 卸载指定 App xcrun simctl uninstall {} {}'.format
clone https://github.com/DeskConnect/SBShortcutMenuSimulator.git cd SBShortcutMenuSimulator make xcrun simctl com.apple.SpringBoard --environment DYLD_INSERT_LIBRARIES=$PWD/SBShortcutMenuSimulator.dylib xcrun simctl
模拟器可以使用xcrun simctl命令获取当前设备运行日志, 真机用libimobiledevice获取日志 xcrun simctl spawn booted log stream --level idf": "8863F83E-70CB-43D5-B6C7-EAB85F3A2AAD" } 如果获取多次数据可以使用shell脚本把命令放到后台,定时写入到logpath中 nohup xcrun simctl
master $ git tag '0.1.0' $ git push --tags 验证 $ pod lib lint xcrun: error: unable to find utility "simctl simctl 再运行一次就正常了。
简单步骤如下: 安装xcode命令行工具 xcode-select --install 创建模拟器 xcrun simctl create "demo" 启动模拟器 xcrun instruments -w 'demo' 安装app xcrun simctl install booted /path/to/Your.app GapDebug 特点 跨平台,应用是个web页面,同时集成了
所以如果有Mac电脑的话,直接使用模拟器进行测试 查找可用的苹果模拟器并打开 找到可以用的模拟器,记住它的udid,例如136437DC-4D51-4628-B8CF-A4A3F3DFF1B0 xcrun simctl
launcher/base/android_base.apk" // apk 目录或自定义调试基座包路径 }, ios: { // uuid 必须配置,目前仅支持模拟器,可以(xcrun simctl
android.intent.action.VIEW -d "myapp://open/product/123" com.example.myapp# iOS测试Universal Linksxcrun simctl
之后在SBShortcutMenuSimulator的目录中执行如下操作: xcrun simctl spawn booted launchctl debug system/com.apple.SpringBoard --environment DYLD_INSERT_LIBRARIES=$PWD/SBShortcutMenuSimulator.dylib xcrun simctl spawn booted launchctl
错误✖ Error running xcrun simctl 解决方案 解决方法:打开Xcode软件选中 Xcode>preferences>Locations里面,设置之后再重新运行检查命令即可。