Calling a method from another application (Jailbreak iOS)

On a jailbroken iOS device, is it possible for one application to call a method from another application (instance method, not static)? Another way to formulate this is: how can I get an instance of the application (assuming the application is running) so that I can call one of its methods?

Reference Information. I am trying to call a function in the Music Player application using the hooked method in iPodUI Private Framework (see this post for more details).

This question was asked for Android , but I did not find anything for iOS jailbreak. If this is because I am asking the wrong question, and there is a different approach, I am open to this.

+7
ios jailbreak tweak
source share
1 answer

A simple and alternative way to achieve this is to call cycript and system (), however, please WARN the dangers of using the system () before using it, since it is potentially unsafe (which, in my opinion, is not so important on jailbroken iOS, where everything is pretty dangerous)

let's say you have a method like [[SomeClass sharedInstance] methodToBeCalledExternally] that you want to call from another process

you can save this call in a text file in /tmp/something.cy

then you enter this code from the outside by running:

 cycript -p Music /tmp/something.cy 

but if you need to do this programmatically, and, of course, if the environment is not isolated (I suppose it is not), you can do:

 system("cycript -p Music /tmp/something.cy") 

this way you can execute arbitrary ObjC code in any process (in this case, in the Music application) from your code.

finally, do not forget to delete the /tmp/something.cy file, as you no longer need it

+2
source share

All Articles