Today we will learn how to open one app from other an also how to pass a string from one app to other. For this we will create two applications.

First App:


  1. Create a new Xcode Project and give it a name Lets say (AppToBeLaunched).
  2. Now go to info.plist and one URL Schema.

Screen Shot 2016-07-13 at 12.50.19 AM.png

3. Now go to AppDelgate.m and write the below code.

– (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {

    NSString *text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];


    UIAlertController *controller = [UIAlertController alertControllerWithTitle:@”See Your Text Below” message:text preferredStyle:UIAlertControllerStyleAlert];


    UIAlertAction * defaultAction  = [UIAlertAction actionWithTitle:@”OK” style:UIAlertActionStyleDefault handler:nil];


    [controller addAction:defaultAction];

    [self.window.rootViewController presentViewController:controller animated:YES completion:nil];


    return YES;


4.  Run this app.

Second App


  1. Create a Xcode Project Lets say (LaunchingApp)
  2. Go to StoryBoard and take one textField and one button.
  3. Make the Proper connection and write the following code

#import “ViewController.h”

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UITextField *inputTextField;


@implementation ViewController

– (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view, typically from a nib.


– (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.


– (IBAction)buttonAction:(id)sender {

    UIApplication *ourApplication = [UIApplication sharedApplication];

    NSString *URLEncodedText = [self.inputTextField.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

    NSString *ourPath = [@”NileshRecieverText://” stringByAppendingString:URLEncodedText];

    NSURL *ourURL = [NSURL URLWithString:ourPath];

    if ([ourApplication canOpenURL:ourURL]) {

        [ourApplication openURL:ourURL];


    else {

        //Display error

        NSLog(@”Cannot Open it”);




4. Now go to info.Plist and add this.

Screen Shot 2016-07-13 at 12.55.08 AM.png

Run the Code and see the desired output.

To download the full Xcode Project Click Here

Enjoy Coding 🙂