ipainstaller
ipainstaller copied to clipboard
Add Shared AppGroup support
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
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:
- backup with ipainstaller -B
- make a copy of AppGroup/UUID
- delete app
- install app with ipainstaller
- 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
- 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
@autopear hi, any chance of adding this feature?
@autopear https://www.youtube.com/watch?v=fNLhxKpfCnA