(Programmatically/Automatically) Removing iOS-Apps - ios

I'm looking for a solution how to remove all installed iOS-Apps from a device. I'm working on a project for iOS-Security. For different analytical stuff on a jail-broken device it's necessary to automatically install a fat bunch of apps, perform all the tests and remove them afterwards to get free space for further applications. The auto installation and test-logic is already done. I only stuck with the apps-removing part.
User installed iOS-Apps are located in /var/mobile/Applications/.
Each application has its own randomly named directory e.g. 7654BE30-F438-42CE-98E0-B95264458C49/.
To proof whether an application is already installed or not my software checks out the com.apple.mobile.installation.plist in /private/var/mobile/Library/Caches/
I've tried to remove the binaries of all applications in /var/mobile/Applications/ and there references in the com.apple.mobile.installation.plist. It seems like the iOS generates a new com.apple.mobile.installation.plist after each installation-process, so it makes no difference whether I remove all the entries out of com.apple.mobile.installation.plist or not. So if I would like to install an application which was already tested someday my software wouln't recognize that it's not installed yet, because it's still listed in com.apple.mobile.installation.plist.
I try to find out where the iOS stores all the information about a user installed application. Would appreciate any help or hint to find out the information. Thanks in advance!
Consider I'm working with an jailbroken iDevice, so everything is possible ;-)

Wipe whole device programmatically
Is there a way to programatically restore my iphone to factory settings?
Uninstall some app programmatically
if you want to uninstall apps, you can use private API "MobileInstallationUninstall". However, it requires entitlement "com.apple.private.mobileinstall.allowedSPI", which you can get, because your device is jailbroken.

Related

Run any app in iOS 10+ from command line without jailbreaking

Is there a way to run any app in iOS 10+ from command line/Mac without jailbreaking?
Re-signing and none of the existing tools seem to work (ios-deploy, Instruments) nor have I been able to find a way via iTunes or other programs.
Yes it is possible for any App you have the source code for.
No it is not possible for any App you acquired from the App store or direct download.
Not quite sure I fully understand your emphasis on any app, but here is what I understand:
1) If you mean you want to run any app from the app store that can currently be downloaded, and you have a .ipa file, you can definitely install it manually to another device using this method (iTunes drag and drop)
2) If, however, you're trying to run an .ipa on a Simulator, that's not possible, as described by this answer.
3) Lastly, if you have source, which I'm confused about since you mention re-signing, then you can easily build that source into an executable for either Simulator or device using either Xcode, or since you asked about command line, you could also use xcodebuild, info found here
I hope one of these 3 options is what you're looking for, as it's hard to tell from the wording of the question. If it's not, expanding on exactly what use case you're trying to resolve would be very helpful.
From the comments in #BHendricks answer, it seems you want to use the command line on your computer to start apps that are installed on an iOS 10+ device.
This is not possible without jailbreaking the phone!
On a jailbroken phone it might be possible to write something that connects over ssh and starts apps, but on vanilla iOS this is disabled for security. You could search for an app that you can send commands, but I highly doubt iOS apps have access to system features like starting other apps, as this is also a large security risk.
If you have the ipa, you can install the app via iTunes. This is what we used to ask QAs to test apps on devices and it works fine. Please refer to this [SO] for detail Install IPA with iTunes 12.
Use Cydia Impactor (cydiaimpactor.com) to sign the app. 99% chance it will work

Update iOS application silently (programmatically)

I'm developing application for in-house distribution (so there can't be rejection from Apple).
As I'll distribute my app using Enterprise distribution, I'm missing one of key features of AppStore - Auto/Manual updates. (I know, that I can show popup users to update application)
Also I know, that application can download dynamic framework with code, and also can download bundle with resources.
So my question: How can I download storyboard (compiled to nib) from remote host, and load it into project?
Or is there anyway to make something like Sparkle.framework on OSX, which will update all the bundle of my app?
You can't update it silently and automatically but you can ditribuite with TestFlight or similar services. Crashlytics present an alert to update if a new version is available (and then use itms-services) .
You can even use itms-services yourself and build your own distribution system if you like.
Take a look at Artisan. They allow you to build portions of your app on their web interface and dynamically swap out views and workflow. It is generally used for A/B testing but could be used for your purposes too. This way you could change significant elements of your app without needing people to update anything. You can even setup different views for different groups of people, and again, all after application launch.
It is also free for <10,000 users, which I am assuming would not be an issue for an enterprise application.

How to simulate iOS version upgrade?

We need to test our app in the context of an iOS upgrade (e.g., 5.1 -> 6.0). Unfortunately, Apple doesn't allow downgrading devices. We thought of doing it in the simulator, but different versions of the simulator are different environments in themselves. I think we can copy the bundle from one simulator to the other, but that won't migrate the keychain (will it?).
Thanks!
To test a transition from one state (before) to another (after), you need a way to put the app in the before state.
Your app surely won't be running while the OS is being updated, so you really only need to worry about the app starting up and discovering that the OS has been updated. There are a couple options:
Copy all your app's data files from a device running the "old" iOS version (5.1 according to your question) to a device running the new (6.0) version. The organizer in Xcode will let you easily copy your app's "container" from a device to your Mac or vice versa.
Make your app write it's data in the "old" format. It's not uncommon for an app to have methods for reading and writing data in different formats depending on the environment, so it's often easier to get your app to write data out in the old format than to actually copy from an old device.
Whichever path you choose, think about any other places (like user defaults) where you might made OS version-dependent changes and set those back to values that correspond to the previous OS. This applies especially to keychain items, which aren't stored in your app's sandbox.
Unit testing frameworks (like Apple's XCTest framework) generally have a setup mechanism that you could use to reset your app to the before state, including copying files, adding and removing keychain items, setting defaults items, etc. You can then add unit tests that run whatever code might be involved in an update and test the results. With a set of easily repeatable tests you'll be able to debug any problems more easily.
However you approach it, the goal is to put the app in the same state that it would be in if it were running for the first time after an OS update occurred. You don't have to worry about simulating the actual OS update, you only need to trick the app into thinking that the update has just happened.
For now, you can still install iOS 8.2. When a new version is released, Apple leaves both versions open for installation for a short time. While that "signing window" is open you can upgrade a device, test, and then restore it from an image of the older version. So you could do some intensive testing while the window is open, but obviously that's not a long-term solution (it typically lasts only a few days).
If you have the budget for it, you could install 8.2 on a device, put a big sticker on it saying "do not upgrade", and keep it on 8.2 for as long as it's relevant. Install your app on that device and take a backup (with backup encryption enabled so that keychain entries will be included), then restore that backup to another device that's on 8.3 - this is basically the same procedure you'll go through when doing an upgrade/restore through iTunes so it should be pretty close. It won't be exactly the same as an OTA update on-device of course, but for that, see option 1 above (and see it soon).

Old interface displayed after Application update

Sometimes, i have strange behaviour while running new version of my applications (native ios application, developed under XCode 4.3).
It seems like some old interface parts displayed, while running new version of application.
It occurs on IOS simulator and on real device, connected to developer machine.
Deleting Derived data doesnt help. Cleaning sources doesnt help.
Deleting and Reinstalling application helps, but i afraid what some users can see old interface.
How to be totally sure what users will see new interface ?
I took a look on similiar question here and there but didnot found answer - how to be sure what users will see new interface after application update. Reinstaling application is not solution.
I dont think you need to worry about this happening when updating through the App Store, as the actual app update procedure is that the update is installed to a new directory, then user documents are copied over, then the old app is deleted.
Better described here What precisely happens when iOS installs an update to an app?
I know for sure that deleted or renamed resource files (like .xib files or images) remain in the bundle on the device or simulator, even if you clean/rebuild the xcode project.
The only way to make sure those files are gone completely, is to remove the app from the home screen, like you described. So I think the undeleted files could be part of your problem.
Also check if you have changed something about the localized .xib files or .strings files.
I'm pretty sure, that if the problem goes away when you delete the app from the home screen, then no end user will encounter your unwanted interface parts.

How to install a program developed in J2ME (JavaME) in a BlackBerry WITHOUT re-booting?

I have a very unreasonable requirement from my overlord.
I developed a little application in JavaME. It is OK.
He is testing the app in different models of the BlackBerry. In some models, after the installation of the .jad, the phone ask for re-boot, in others, you could use the app just after the installation.
As a new requirement the app must be functional without re-booting.
Could you tell me how to do this? and with which code of JavaME? Have not found any relevant information (in code) about it.
Notice that the app is developed with Java and NOT with the BB SDK. Even more, I don't know the architecture of the BB's to see why in some cases it needs re-booting (neither the architecture of the other mobiles that work with JavaME!!).
If the application has not been installed on a device previously (or the device has been rebooted after the application has been removed) then you should not have to reboot after installation. There are a number of reasons why removal or replacement of (upgrading) an application will require a reboot. They all boil down to the OS has only one instance of the JVM and it is still holding references to objects that are defined in the application.
A very simple application that has not run since the last garbage collection may be replaced without rebooting. Any application that registers a listener or other objects with the the OS, or runs in the background will usually require a reboot.
To test what a new customer would experience having never used your application before try this:
If the application is installed on the device, remove it.
If the device does not reboot, reboot it (Alt-Caps-Del or battery pull).
Once it has finished restarting install the application.

Resources