Xcode(4.6)中有没有办法在安装之前删除设备上的应用程序?
我需要它来进行测试,如果在再次安装之前从设备中删除应用程序会更容易。
是的你可以。
获取https://github.com/libimobiledevice/ideviceinstaller
这使您能够ideviceinstaller --uninstall <app-id>
在 bash 环境中使用。
然后在 xcode 的构建配置中做一个脚本,例如:http ://www.runscriptbuildphase.com/
唯一的方法是手动删除它。如果这是您所要求的,则无法让 xcode 在每次运行之前从设备中删除该应用程序。抱歉,这将是一个很棒的功能,但目前还没有办法做到这一点。甚至在模拟器上也没有。
我认为您应该向苹果提交错误/功能请求!该功能对我来说会派上用场!
XCode 不提供每次运行时自动从设备中删除应用程序的选项,但简单的方法是使用“设备”屏幕一键将其删除。
如何创建一个 Xcode 构建脚本以退出 Simulator,然后删除 Simulator Applications 目录的内容。目录是
~/Library/Application Support/iPhone Simulator/6.1/Applications/
不,没有办法自动删除应用程序。
但是您可以编写一个简单的函数来清除上次运行的所有应用程序资源,如下所示:
-(无效)清理{ NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier]; [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain]; [MagicalRecord saveWithBlockAndWait:^(NSManagedObjectContext *context) { [[NSManagedObjectModel MR_defaultManagedObjectModel].entities enumerateObjectsUsingBlock:^(NSEntityDescription *entityDescription, NSUInteger idx, BOOL *stop) { [NSClassFromString([entityDescription managedObjectClassName]) MR_truncateAllInContext:context]; }]; }]; }
像 HackyStack 一样,我认为你必须手动删除应用程序。也就是说,您可以使用调试启动方法来清除安装期间未覆盖的内容。例如,删除文档目录的内容、与应用程序关联的钥匙串项目、iCloud KV 信息和文档等的方法。这会有点痛苦,但可能会让你去你想去的地方......
2021 年更新(macOS 11.2.3、 Xcode12.4):我必须mobiledevice uninstall_app com.example.bundleid
将
工作解决方案 macOS 10.15.2、Xcode11.3、iOS13.3 (iPhone XS)、iOS12.4.4 (iPhone 5S)
brew install mobiledevice
(https://github.com/imkira/mobiledevice)mobiledevice uninstall_app com.example.bundleid