Skip to content

Instantly share code, notes, and snippets.

@engmsaleh
Forked from jonalter/info.plist
Created October 6, 2015 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save engmsaleh/6cdb96d4a402bd8a0e77 to your computer and use it in GitHub Desktop.
Save engmsaleh/6cdb96d4a402bd8a0e77 to your computer and use it in GitHub Desktop.
iOS: launch your app from another app
// info.plist from Test 5
// Open your info.plist and look for CFBundleURLSchemes
// this is the string that you will use to open that app
// You can also copy the info.plist to the root of your app and edit it.
// You can even have multiple schemes that you can use to launch it.
// Here I can launch the app using either 'test5://' or 'pedro://'
// Be SURE to do a clean build
<key>CFBundleURLSchemes</key>
<array>
<string>test5</string>
<string>pedro</string>
</array>
// TEST 5 app.js
// this is the app that will be launched
// get the args that the app was launched with
var args = Ti.App.getArguments();
var win = Ti.UI.createWindow({
backgroundColor: "blue"
});
var button = Ti.UI.createButton({
title: 'Get Args',
height: 50,
width: 250
});
button.addEventListener('click', function(e){
alert(args);
});
win.add(button);
win.open();
// TEST 7 app.js
// This app will launch the app named Test 5
var win = Ti.UI.createWindow({
backgroundColor : 'red'
});
var testButton = Ti.UI.createButton({
title : "Open Test 5",
height : 50,
width : 250,
});
testButton.addEventListener('click', function(){
Ti.API.info( Ti.Platform.canOpenURL('test5://') );
Ti.Platform.openURL('test5://');
});
win.add(testButton);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment