1

I want to make one internal application(not want to put it on AppStore). In which i have following scenario.

I am putting my app(say "XApp") in background. Now, i open other app in foreground(Say "YApp"). Now, i want to get the current elements hieararchy of the YApp in Xapp. I am having development provisioning profile/certificate for the Yapp.

I just want the Element hierarchy, almost similar to what i get, if i run the UIAutomation of instruments and throw the following command through .js script.

UIATarget.localTarget().frontMostApp().logElementTree();

In short, i need same result as from above command, but without connecting device to any PC via usb cable. It is OK, if it is by using private apis or for jailbroken device. As i have mentioned that, i dont want to put it on App Store.

EDIT:

I can find elements hierarchy of my own app, i.e. for XApp itself, by runnning following code as,

-(void) showViewHeirarchy:(UIView*)v
{
    for (UIView *vv in v.subviews) 
    {
        NSLog(@"SubView:%@",[vv description]);
        NSLog(@"count:%lu",(unsigned long)vv.subviews.count);
        if (vv.subviews.count>0) 
        {
            [self showViewHeirarchy:vv];
        }
    }
}

Calling above function after viewDidLoad method completed its execution(not in viewDidLoad), and calling it such as:

UIWindow *v=[[UIApplication sharedApplication] keyWindow];
[self showViewHeirarchy:v];

So, can anyone know how to get refrence of UIApplication object of one App from other App(running in background), so that my job will became easier.

Mehul Thakkar
  • 12,440
  • 10
  • 52
  • 81
  • Is it necessary, that "XApp" is an app on the device? Perhaps you could use something like MonkeyTalk to integrate a small web server in "YApp" to access the UI hierarchy from outside (e.g. via WLAN in this case). – Christian Feb 07 '14 at 06:41
  • Ya, XApp is on Device and it is running in background, YApp is any other App that have been already developed, and i am going to put YApp on App Store. So, i cant change any code of YApp, i can only do anything(any code changes) with XApp(may use private apis) and want to get just UI Elements hiearchy of YApp(or any frontmost app-developed by me). – Mehul Thakkar Feb 07 '14 at 06:53

0 Answers0