ipainstaller icon indicating copy to clipboard operation
ipainstaller copied to clipboard

Add Shared AppGroup support

Open mailinglists35 opened this issue 9 years ago • 3 comments

Some apps are storing data in the ~mobile/Containers/Shared/AppGroup directory. These apps do not function normally after a restore, because they miss the data from the AppGroup/UUID directory. Implementing this could fix issues like #11

mailinglists35 avatar Jul 22 '15 21:07 mailinglists35

crossposting to https://bitbucket.org/scottywz/appbackup/issues/2/support-working-with-apps-on-ios-8

for example, WhatsApp stores like this:

iPhone:/var/mobile/Containers root# plutil -key MCMMetadataInfo $(ipainstaller -i net.whatsapp.WhatsApp|grep ^Data:|cut -d\  -f2)/.com.apple.mobile_container_manager.metadata.plist
{
    "com.apple.MobileInstallation.ContentProtectionClass" = 0;
    "com.apple.MobileInstallation.GroupContainerIDs" =     (
        "group.net.whatsapp.WhatsApp.shared"
    );
}

take each value of "com.apple.MobileInstallation.GroupContainerIDs" and search it in every folder

iPhone:/var/mobile/Containers root# for file in $(find Shared/AppGroup/ -type f -name .com.apple.mobile_container_manager.metadata.plist); do grep -- 'group.net.whatsapp.WhatsApp.shared' $file; done

Binary file Shared/AppGroup/B0A2102D-3E87-4767-961F-24336E04B066/.com.apple.mobile_container_manager.metadata.plist matches

We found the folder, include it in the backup.

Restore: ipainstaller complained about not being able to restore documents, I have had to restore manually like this:

  1. backup with ipainstaller -B
  2. make a copy of AppGroup/UUID
  3. delete app
  4. install app with ipainstaller
  5. lookup the data directory with -i, unzip the IPA, copy files from inside the IPA file in the Container directory to Data/uuid directory BUT EXCLUDE THE FILE .com.apple.mobile_container_manager.metadata.plist, adjust permissions mobile:mobile
  6. lookup the AppGroup directory, restore data from step 2, EXCLUDE .com.apple.mobile_container_manager.metadata.plist file

Unfortunately I don't think AppGroup files are allowed inside IPA files, so I commented on AppBackup issue tracker, maybe they can add support to the console app

Probably there are some API calls to directly find UUID and skip searching, but I'm a sysadmin, not a programmer. You could possibly find more here?

https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW6 http://www.atomicbird.com/blog/sharing-with-app-extensions https://invasivecode.com/weblog/sharing-data-between-apps-and-their-extenstions/ http://stackoverflow.com/questions/24015506/communicating-and-persisting-data-between-apps-with-app-groups/24066826#24066826 http://webcache.googleusercontent.com/search?q=cache:Jc7tC01ar7IJ:https://groups.google.com/d/topic/rubymotion/qDsNSf8NtXM+&cd=9&hl=en&ct=clnk&gl=ro

Note: I have modified WhatsApp Info.plist to allow it to backup with Shared documents:

plutil -key UIFileSharingEnabled -type bool -value true /var/mobile/Containers/Bundle/Application/UUID/WhatsApp.app/Info.plist

mailinglists35 avatar Jul 22 '15 22:07 mailinglists35

@autopear hi, any chance of adding this feature?

mailinglists35 avatar May 06 '16 15:05 mailinglists35

@autopear https://www.youtube.com/watch?v=fNLhxKpfCnA

mailinglists35 avatar Jan 28 '18 18:01 mailinglists35