从Mac命令行访问iOS应用程序目录(沙箱) [英] Command line access to iOS app directory (sandbox) from Mac

查看:411
本文介绍了从Mac命令行访问iOS应用程序目录(沙箱)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用Mac或Linux上的命令行(non-gui)访问安装在iOS设备上的应用程序的沙箱目录。这有助于开发和测试自动化。将json文件拖放到沙箱中可以让我设置参数,例如额外的调试消息和更小的刷新间隔。

I need to access the sandbox directory for an application installed on an iOS device, using the command line (non-gui) from a Mac or Linux. This is to help with development and testing automation. Dropping a json file into the sandbox lets me set parameters like extra debug messages and smaller refresh intervals.

像iFunBox这样的工具工作正常,但只是图形化,需要多次点击做这个。发给开发人员的电子邮件没有得到答复。它也不支持AppleScript。我确实找到了另一个提供Fuse模块的应用程序,但是如果应用程序被卸载然后重新安装(为了重置为第一次用户体验),它就变成了错误。我向开发者报告了这些问题,但没有解决问题。

A tool like iFunBox works perfectly but is graphical only, requiring numerous clicks to do this. Emails to the developers were unanswered. It also does not support AppleScript. I did find another app that provided a Fuse module, but it turned out buggy especially if the app was uninstalled and then reinstalled (in order to reset back to first time user experience). I reported the problems to the developer but there is no fix on the horizon.

我需要做的事情是:


  • 测试是否安装了具有特定软件包ID的应用程序

  • 创建库/ Caches / MYLIBNAME目录(如果不存在)

  • 将一个~100字节的json文件从Mac复制到该目录

  • 获取该文件的副本

  • 解决方案仅适用于Linux也是可以接受的

  • 设备不会越狱,我不希望将其作为一项要求

  • Test if an app with a specific bundle id is installed
  • Create Library/Caches/MYLIBNAME directory if it doesn't exist
  • Copy a ~100 byte json file from the Mac to that directory
  • Get a copy of that file
  • A solution that only works from Linux is acceptable too
  • Devices are not jailbroken and I would prefer not to need that as a requirement

在某些情况下,我没有应用程序的源代码,因为它是使用我的库的第三方,因此编译应用程序的不同版本是不切实际的。

In some cases I do not have the source code to the app since it is a third party using my library, so compiling different versions of the app isn't practical.

感谢lxt,许多评论中的答案如下。总结是:


  • 与libimobiledevice相关的各种库和程序可以解决问题

    • 使用打补丁 iFuse挂载应用程序沙箱

    • 使用idevicesyslog查看控制台日志

    • 使用ideviceinstaller安装/卸载应用程序

    • Various libraries and programs associated with libimobiledevice can solve the problems
      • Use patched iFuse to mount an application sandbox
      • Use idevicesyslog to see the console log
      • Use ideviceinstaller to install/uninstall apps

      • 对于Ubuntu尝试libimobiledevice(可能有3个后缀),ideviceinstaller和libimobiledevice-utils软件包

      • 对于Mac来说,搜索libimobiledevice-macosx可能会让你有一些方法

      推荐答案

      这会有点棘手,因为我认为你已经发现应用程序名称是随机生成的你安装。我不认为有过这样的方式,当然我知道。这解释了您在模拟新安装时遇到的问题(...应用程序目录名称更改为新的随机哈希,然后您被卡住了。)

      This is going to be a little tricky, because as I think you've found out the application name is randomly generated on every install. I don't think there is a way past that, certainly that I know of. This explains the problems you're running into when simulating a new install (...the app directory name changes to a new, random hash, and then you're stuck).

      虽然我倾向于以其他方式访问此配置文件(可能通过网络,并且只有一些代码只能在调试/测试版本上执行检查),如果你确实想这样做,那么我'建议尝试编写一个脚本,当你想要模拟一个新的安装时,选择最近修改过的app目录。但这非常hacky。

      Although my preference would be to access this config file in some other way (perhaps over a network, and have some code that only executes on debug/test builds check for it), if you did want to do this then I'd suggest trying something like writing a script that when you want to simulate a new install chooses the app directory that's most recently modified. But this is very hacky.

      如果您无法插入仅在调试/测试版本上执行的条件代码,那么我认为iOS使用的随机应用程序命名架构无论采取何种方法,在文件系统级别都会出现问题。

      If you're not able to insert conditional code that only executes on debug/ test builds then I think the random app naming schema that iOS uses at a file system level is going to be problematic for you whatever approach you take.

      更新:关于iFuse和libimobiledevice - 开箱即用它限制你到文件目录。这是因为iFuse的作者不会让入门级用户感到困惑,也因为结构因iOS版本而略有不同。你可以注释掉iFuse源代码中的行 - fuse_opt_add_arg(& args, - osubdir = Documents); - 通过mount访问库目录。如果这样做,你显然需要自己重新编译iFuse。

      Update: Regarding iFuse and libimobiledevice - out of the box it limits you to the documents directory. This is because the authors of iFuse don't entry-level users to be confused, and also because the structure is a little different depending on iOS version. You can comment out the lines in the iFuse source - fuse_opt_add_arg(&args, "-osubdir=Documents"); - to get access to the library directory through the mount. You will obviously need to re-compile iFuse yourself if doing this.

      这篇关于从Mac命令行访问iOS应用程序目录(沙箱)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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