Appstore apps automatic downloading/deleting

Hi! I’m interested in an automation of the process of downloading and deleting Appstore apps on iOS 9. Namely, I would like to write a tweak which takes a link to an iTunes page with a free app as an input, downloads it, installs, does some stuff and then deletes the app.
At the moment, the only way I see of doing this is to open iTunes page with [NSApplication openURL:] and press some buttons via injecting into StoreKitUI, possibly closing some UIAlertViews along the way. I’m not sure yet, but it seems like an uninstall can be performed in the same fashion.
So, although I have some method here, it feels quite unreliable. Can anyone suggest a better approach? Any other thoughts on the topic would also be greatly appreciated. Thanks in advance!

If you feel that the operations on StoreKitUI level is not elegant enough, you can keep reversing to the logic level of any AppStore operations, which will not reflect on UI at all

Yep, that’s a way. Thanks! Great book, by the way)