Launch an app from within another (iPhone)

Is it possible to launch any arbitrary iPhone application from within another app?, For example in my application if I want the user to push a button and launch right into the Phone app (close the current app, open the Phone app).

would this be possible? I know this can be done for making phone calls with the tel URL link, but I want to instead just have the Phone app launch without dialing any specific number.

launch native iphone application from within another

I wanted from within my application to open another native iPhone application installed on the device. I used openUrl method and give it the URL schema for that application but it always launch the we



Launch the compass app from within iPhone app

I’m trying something like this to launch the compass from within my app: NSString *stringURL = @compass://; NSURL *url = [NSURL URLWithString:stringURL]; [[UIApplication sharedApplication] openURL:

Is it possible to launch Google+ iPhone app from within another app?

I know the url scheme is the only way to do it. Is Google+ having that? And where can I check whether an app has registered url? Thanks!

How do you launch Safari browser from within an iPad app? [duplicate]

Possible Duplicate: launch safari from iphone app How do you launch Safari browser from within an iPad app?

launch safari from iphone app

This might be a rather obvious question, but can you launch the Safari browser from an iphone app? all the best.

how to launch iPhone Calendar from within an iPhone application?

Is it possible, and how could I, launch the iPhone calendar application from within an iPhone application. For example your application may have a select date, and then a launch iPhone calendar fo

start an iphone app from within another iphone app?

Is it possible to write a function in an iphone app A that when you click on a button within that app A it will close app A and automaticall open up App B

How to launch another app from an iPhone app

I am working on a map application in my iPhone app. I have a button go. When the user clicks this button in this method I want to check if user has installed the waze application on his iphone. If ye

How can to launch the Mail app from within my app?

How do I launch the iPhone Mail app (with a Photo attachment) from within my app? (Photo is a UIImage in my app).

launch photo gallery from iphone App

Is it possible to launch (redirect the user to) the native photo gallery application of iphone from my app, similar to emails? Is this now possible in 4.2 sdk?

Answers

No it’s not. Besides the documented URL handlers, there’s no way to communicate with/launch another app.

As Kevin points out, URL Schemes are the only way to communicate between apps. So, no, it’s not possible to launch arbitrary apps.

But, it is possible to launch any app that registers a URL Scheme, whether its Apple’s, your’s, or another developer’s. The docs are here:

Communicating with Other Applications

As for launching the phone, looks like your tel: link needs to have least three digits before the phone will launch. So you can’t just drop into the app w/o dialing a number.

You can only launch apps that have registered a URL scheme. Then just like you open the SMS app by using sms:, you’ll be able to open the app using their URL scheme.

There is a very good example available in the docs called LaunchMe which demonstrates this.

Here is a good tutorial for launching application from within another app:
iOS SDK: Working with URL Schemes
And, it is not possible to launch arbitrary application, but the native applications which registered the URL Schemes.

I also tried this a while ago (Launch iPhone Application with Identifier), but there definitely is no DOCUMENTED way to do this. 🙂

I found that it easy to write an app that into that app you can open another app.Let’s assume that we have two apps call: FirstApp and SecondApp. And when we standing at the FirstApp,then we want to open the SecondApp by click a button. The solution is:

  1. With SecondApp

    into the plist file of SecondApp we need to add a URL Schemes with a string iOSDevTips(of course you can write another string.it’s up to you).

Launch an app from within another (iPhone)

2 . With FirstApp

Just create a button have below action:

- (void)buttonPressed:(UIButton *)button
{
  NSString *customURL = @"iOSDevTips://";

  if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]])
  {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
  }
  else
  {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL error"
                              message:[NSString stringWithFormat:@"No custom URL defined for %@", customURL]
                              delegate:self cancelButtonTitle:@"Ok" 
                              otherButtonTitles:nil];
    [alert show];
  }

}

That’ it. Now you can click the button into the FirstApp to open the SecondApp

Try the following code will help you to Launch an application from your application

Note: Replace the name fantacy with actual application name

NSString *mystr=[[NSString alloc] initWithFormat:@"fantacy://location?id=1"];
NSURL *myurl=[[NSURL alloc] initWithString:mystr];
[[UIApplication sharedApplication] openURL:myurl];

The lee answer is absolutely correct for iOS prior to 8.

In iOS 9 you must whitelist any URL schemes your App wants to query in Info.plist under the LSApplicationQueriesSchemes key (an array of strings):

Launch an app from within another (iPhone)

In Swift

Just incase someone was looking for a quick Swift copy and paste

if let url = NSURL(string: "app://") where UIApplication.sharedApplication().canOpenURL(url) {
            UIApplication.sharedApplication().openURL(url)
} else if let itunesUrl = NSURL(string: "https://itunes.apple.com/itunes-link-to-app") where UIApplication.sharedApplication().canOpenURL(itunesUrl) {
            UIApplication.sharedApplication().openURL(itunesUrl)      
}

Apple does not allow this, my app got rejected from this code, and they asked me to remove it.

btw, my code in Objective-c:

NSString *iTunesLink = @"https://itunes.apple.com/itunes-link-to-app/idxxxx?mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];

Swift 3 quick and paste version of @villy393 answer for :

if UIApplication.shared.canOpenURL(openURL) {
    UIApplication.shared.openURL(openURL)
} else if UIApplication.shared.canOpenURL(installUrl) 
    UIApplication.shared.openURL(installUrl)
}

In order to let you open your application from another, you’ll need to make changes in both applications. Here are the steps using Swift 3 with iOS 10 update:

1. Register your application that you want to open

Update the Info.plist by defining your application’s custom and unique URL Scheme.

Launch an app from within another (iPhone)

Note that your scheme name should be unique, otherwise if you have another application with the same URL scheme name installed on your device, then this will be determined runtime which one gets opened.

2. Include the previous URL scheme in your main application

You’ll need to specify the URL scheme you want the app to be able to use with the canOpenURL: method of the UIApplication class. So open the main application’s Info.plist and add the other application’s URL scheme to LSApplicationQueriesSchemes. (Introduced in iOS 9.0)

Launch an app from within another (iPhone)

3. Implement the action that opens your application

Now everything is set up, so you’re good to write your code in your main application that opens your other app. This should looks something like this:

let appURLScheme = "MyAppToOpen://"

guard let appURL = URL(string: appURLScheme) else {
    return
}

if UIApplication.shared.canOpenURL(appURL) {

    if #available(iOS 10.0, *) {
        UIApplication.shared.open(appURL)
    }
    else {
        UIApplication.shared.openURL(appURL)
    }
}
else {
    // Here you can handle the case when your other application cannot be opened for any reason.
}

Note that these changes requires a new release if you want your existing app (installed from AppStore) to open. If you want to open an application that you’ve already released to Apple AppStore, then you’ll need to upload a new version first that includes your URL scheme registration.

To achieve this we need to add few line of Code in both App

App A: Which you want to open from another App.

App B: From App B you want to open App A

Code for App A

Add few tags into the Plist of App A Open Plist Source of App A and Past below XML

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>com.TestApp</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>testApp.linking</string>
        </array>
    </dict>
</array>

In App delegate of App A – Get Callback here

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
// You we get the call back here when App B will try to Open 
// sourceApplication will have the bundle ID of the App B
// [url query] will provide you the whole URL 
// [url query] with the help of this you can also pass the value from App B and get that value here 
}

Now coming to App B code

If you just want to open App A without any input parameter

-(IBAction)openApp_A:(id)sender{

    if(![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"testApp.linking://?"]]){
         UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"App is not available!" message:nil delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
            [alert show];

        }
}

If you want to pass parameter from App B to App A then use below Code

-(IBAction)openApp_A:(id)sender{
    if(![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"testApp.linking://?userName=abe&registered=1&Password=123abc"]]){
         UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"App is not available!" message:nil delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
            [alert show];

        }
}

Note: You can also open App with just type testApp.linking://? on safari browser