allisius
allisius

Reputation: 415

is it possible to force iOS device to open up / switch to my app from said app programatically?

I would like to make an app, that opens and present itself to a user when a certain block of code is executed from inside that app. Is it possible like that?

Another solution would be to display a local alert notification, that would open the app on tap. But is it possible to do that without the notification?

Upvotes: 1

Views: 124

Answers (2)

Nimit Parekh
Nimit Parekh

Reputation: 16864

Nope,You can't directly open the another app.

If you want to open another app using you app for that need to implement URL Schemes.

Here is basic example for open google map in Objective-C

-(IBAction) openMaps:(id)sender {
    // Opens a map containing Envato's Headquarters
    UIApplication *ourApplication = [UIApplication sharedApplication];
    NSString *ourPath = @"http://maps.google.com/maps?ll=-37.812022,144.969277";
    NSURL *ourURL = [NSURL URLWithString:ourPath];
    [ourApplication openURL:ourURL];
}

And Here is best tutorial for create custom URL Schemes in Objective-C.

Upvotes: 2

Pravin Tate
Pravin Tate

Reputation: 1130

No, with out user interaction you can't open your app. There is only two way for opening app as follow

  • Using local notification
  • Using NSURL schema

you can't directly open your app.

Upvotes: 2

Related Questions