1
votes

I am currently developing an "in device" (not simulator) monitoring system for an iPad app. The system should be able to do the following:

-User input simulation: Simulate user inputs: taps, drags, keyboard.

-Information recollection: Get text values and results after doing inputs.

This information will be later reported to an event management server. I have already taken care of the two points in a single app, by using some code from KIF software https://github.com/square/KIF and some self developed code. I use the accessibleName property of the UIView objects to get their pointer and send artificial events to the [[UIApplication sharedApplication] sendEvent:] method.

Here’s the thing: I need to send these events from app#1 in which I am, to app#2. (To keep the monitoring independent, also embedding all the code in app#2 is not an option) I use the [[UIApplication sharedApplication] openURL:] method to open the app#2. https://developer.apple.com/library/IOs/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html#//apple_ref/doc/uid/TP40007072-CH7-SW18

The problem is, I cannot send events from app#1 to app#2 because I cannot seem to get the pointer to the [UIApplication sharedApplication] object of app#2 in the app#1 code.

A shared memory communication between the processes would be great, but according to the information that I found, the URL messaging scheme seems to be the only communication between apps (or processes) in iOS. The NSConnection class is also not present in iOS. I've also read a little bit about Mach ports and POSIX file descriptors, but they seem fairly complicated and I have no idea if they can help.

I even tried to send the value of the pointer of the app#2 [UIApplication sharedApplication] instance as a string parameter in the URL message, then converted the string back to a pointer in app#1, but got a EXC_BAD_ACCESS. I suppose the pointer address does not mean the same in both processes. Maybe each process has its own "offset"? Any help would be greatly appreciated.

1

1 Answers

2
votes

In first instance I wold clarify that what you want to do is not possibile without private APIs. Each app is sandboxed and you cannot access to other apps (directly). I think that your problem is really big.

Each app running in iOS is like small, independent, eco-system that ends when the user press the 'Home' button (except if you declare some background services like VOIP, localization or audio player). Once the app has been closed the only thing that you can still run is a process that should not be longer than 10 mins. This is to prevent an excessive usage of background tasks and even here, the app isn't accessible from other apps.

I think the only way is to search for private APIs, hoping someone else already found a way to create a data streaming (directly) between 2 apps.