如何从命令行从iOS 8 Simulator中删除应用程序? [英] How do I remove app from iOS 8 Simulator from command line?

查看:100
本文介绍了如何从命令行从iOS 8 Simulator中删除应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS模拟器中运行了一个自动化程序,在再次运行之前必须删除该自动化程序。如何从命令行从iOS Simulator中删除该应用程序?

I have an automation running in the iOS Simulator that I have to remove before another run. How do I remove the app from the iOS Simulator from the command line?

对于每个模拟器设备目录(位于〜/ Library / Developer / CoreSimulator / Devices / * ),我
试图删除。/data / Containers / Bundle / Application / ./ data / Containers / Data / Application /

For each simulator device directory (located at ~/Library/Developer/CoreSimulator/Devices/*), I tried to delete ./data/Containers/Bundle/Application/ and ./data/Containers/Data/Application/.

即使我尝试通过长按应用程序中的来删除该应用程序模拟器(该应用变得不稳定),然后单击X按钮,未清除用户默认设置。我希望应用程序状态为100%清除。

Even when I tried to delete the app by long pressing the app in the Simulator (the app becomes jiggly) and click on the X button, the user defaults were not being cleared. I want the app state to be 100% clean.

我找到了解决此问题的好方法。

I found a good solution to solve this problem.

推荐答案

我们发现一种删除用户默认设置的方法是删除 ./ data / Library / Preferences / * 中的所有文件。除了删除应用程序和数据目录。

One approach that we found for deleting user defaults is to delete all files in the ./data/Library/Preferences/* in addition to deleting application and data directories.

但是,在Xcode 6中,命令 xcrun 具有新的子命令 simctl 允许我管理iOS Simulator,包括重置模拟器和安装应用程序。

However, in Xcode 6, the command xcrun has new subcommand called simctl that allows me to manage iOS Simulator including resetting the simulator, and installing the application.

我来的解决方案

xcrun simctl erase [device ID]

示例

如果 xcrun simctl列表)返回

9DDA0CFE-7CEC-40B6-A343-1EC01F282B22 (active, disconnected)
    Watch: Apple Watch Series 2 - 42mm (88474523-163E-4021-B591-2AECBFA26997) (Shutdown)
    Phone: iPhone 7 Plus (5785E680-15CD-42D3-82AB-597286A270C5) (Shutdown)

然后运行这两个命令

xcrun simctl erase 88474523-163E-4021-B591-2AECBFA26997
xcrun simctl erase 5785E680-15CD-42D3-82AB-597286A270C5






可以通过运行获取设备ID

xcrun simctl list

这将重置模拟器(相当于 iOS Simulator>重置内容和设置... 菜单项。)

This will reset the simulator (equivalent to iOS Simulator > Reset Contents and Settings... menu item).

对于Xcode 6.0.1(内部版本6A317),可能是错误或更改行为,即在卸载应用程序时不会删除用户默认设置。

With Xcode 6.0.1 (Build 6A317), there is either a bug or a change in behavior where when you uninstall an application, user defaults are not removed.

Usage: simctl [--noxpc] [--set <set path>] <subcommand> ... | help [subcommand]
Command line utility to control the iOS Simulator

For subcommands that require a <device> argument, you may specify a device UDID
or the special "booted" string which will cause simctl to pick a booted device.
If multiple devices are booted when the "booted" device is selected, simctl
will choose one of them.

Subcommands:
    create        Create a new device.
    delete        Delete a device.
    erase         Erase a device's contents and settings.
    boot          Boot a device.
    shutdown      Shutdown a device.
    rename        Rename a device.
    getenv        Print an environment variable from a running device.
    openurl       Open a URL in a device.
    addphoto      Add a photo to the photo library of a device.
    install       Install an app on a device.
    uninstall     Uninstall an app from a device.
    launch        Launch an application by identifier on a device.
    spawn         Spawn a process on a device.
    list          List available devices, device types, or runtimes.
    notify_post   Post a darwin notification on a device.
    icloud_sync   Trigger iCloud sync on a device.
    help          Prints the usage for a given subcommand.

这篇关于如何从命令行从iOS 8 Simulator中删除应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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