2

I have a jailbroken iPhone, is it possible to take a zip of the entire application directory (e.g. /private/var/mobile/Applications/{UID}) and then use that zip to install the application?

Ultimately, I'm attempting to save the state of this application so I can run tests, and then return it to this state.

Nate
  • 31,017
  • 13
  • 83
  • 207
jbh
  • 1,153
  • 2
  • 11
  • 24
  • An iOS application does not change while in use. What you probably want to do here is delete the application's preferences and data. –  Sep 07 '13 at 21:31
  • So, really i want to be able to "drop" an application in the state i save it in from another root level application. so pretty much this application will save off the application (zip it) and then drop it back into place and with a springboard refresh it will be back in its original state. – jbh Sep 07 '13 at 21:35
  • @duskwuff, the **executable** does not change while in use, but the contents of the `/var/mobile/Applications/{UID}/` folder does, as that contains the app's docs, caches, user defaults, etc. – Nate Sep 07 '13 at 21:53

1 Answers1

2

Yes, you can do this.

Assuming that the entire state of your application is saved in places like the Documents, or Caches folders, or in app preferences (NSUserDefaults).

You can make a zip of /var/mobile/Applications/{UID}, ssh/scp that .zip file back to your computer (or store it elsewhere on your iPhone), and then unzip it later.

Depending on whether you move the app (install it in a different location), or completely delete it at some point, you may need to refresh the list of apps after you restore (unzip the .zip file). You can do that either by rebooting, respringing (restart SpringBoard), or ssh'ing into the device and issuing the uicache command:

ssh mobile@iphone uicache

Note: I think you understand this based on your question, but you do need to zip up the whole /var/mobile/Applications/{UID}/ directory. Not just the MyAppName.app directory under it. That's because, for example, of where the data, user defaults plist, etc. are stored. If you are concerned about the speed of your backup and restore operations, or disk usage, you could probably try to narrow down which files you backup (e.g. ./Documents/ and ./Library/) ... I'll leave that to you.

Community
  • 1
  • 1
Nate
  • 31,017
  • 13
  • 83
  • 207