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.