1

How to Launch an iOS native app from the current native app

In Objective C I can write like

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"SomeApp"]]

How can I achieve the same in JavaScript?

var window = UIATarget.localTarget().frontMostApp().mainWindow();

Above code uses UIATarget,Is it possible to access the UI elements of the new app as it was launched from another app. I think it might not be possible,but I would like to use it for testing and I don't want to use Jail breaking.

If that can be done in JavaScript, Could somebody provide pointers on this ?

In Android, using some frameworks we can access the UI elements of any Application.

Is it feasible in iOS ?

Ram
  • 1,872
  • 5
  • 31
  • 54
  • 3
    Accessing elements in another app: I could be wrong, but I'm pretty sure that this is not possible. iOS has very good sandboxing for Apps in order to prevent you doing things like this. – George Green Jan 17 '14 at 13:46
  • try to see this: http://stackoverflow.com/questions/4671634/create-a-link-that-either-launches-ios-app-or-redirects-to-app-store – Ilario Jan 17 '14 at 14:12

2 Answers2

1

URL Schemes are the only way to communicate between apps.

Communicating Between Apps

Jordan.J.D
  • 7,999
  • 11
  • 48
  • 78
0

When using Instruments/cmd line UI testing (Tune_up.js) you cannot communicate with apps outside of the target testing app. When your app leaves the foreground you won't be able to get it back except for one case.

UIATarget.deactivateAppForDuration();

This will behave as though the user has hit the home button, and after the duration goes to the multi-tasking board and brings your app back to the foreground.

Acludia
  • 344
  • 1
  • 8