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.