Using App URL Schemes in Corona

I have added a URL scheme to my corona app

iphone = { plist = { CFBundleURLSchemes = { "myapp1234567" } } }

In my other iOS app I want to detect if the corona app is installed on a device so I use this code

 if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"myapp1234567://whateveryouwant"]]) { //YES THIS APP IS INSTALLED :) }

The problem is that this does not work. The iOS code I am pretty sure is correct so I am thinking something is wrong or missing with my setting.

Anyone know if I missed something?

Corona SDK does not support the idea of “canOpenURL”.  However, system.openURL() will return false if it fails to load the URL.  While it’s not the same thing, it’s a way to try and open the app and know if it could not.

Rob

Hi

Ok but this is not what I want. Sorry for the poor explanation.

I have one app built with Corona and one app built with Objective C. I want to promote my Corona app inside the Objective C app. But if the Corona app is already installed I do not want the banner/promotion to be displayed.

So I actually just have to add the CFBundleURLSchemes to my Corona app. The check will be done in Objective C (and here the idea of canOpenUrl exist).

I found this documentation so it seems to be possible or?

http://coronalabs.com/blog/2011/12/22/using-app-url-schemes-in-ios/

Your URL scheme needs another layer of tables.  If you look in the SampleCode/Networking/Facebook you can set the right syntax which is:

                        CFBundleURLTypes =                         {                                 {                                         CFBundleURLSchemes =                                         {                                                 "fbXXXXXXXXX",  -- replace XXXXXXXXX with your facebook appId                                                                                          }                                 }                         }

Notice that CFBundleURLSchemes is a table inside of an unnamed table inside of CFBundleURLTypes.

Rob

ahh perfect that worked :slight_smile:

thanks

Corona SDK does not support the idea of “canOpenURL”.  However, system.openURL() will return false if it fails to load the URL.  While it’s not the same thing, it’s a way to try and open the app and know if it could not.

Rob

Hi

Ok but this is not what I want. Sorry for the poor explanation.

I have one app built with Corona and one app built with Objective C. I want to promote my Corona app inside the Objective C app. But if the Corona app is already installed I do not want the banner/promotion to be displayed.

So I actually just have to add the CFBundleURLSchemes to my Corona app. The check will be done in Objective C (and here the idea of canOpenUrl exist).

I found this documentation so it seems to be possible or?

http://coronalabs.com/blog/2011/12/22/using-app-url-schemes-in-ios/

Your URL scheme needs another layer of tables.  If you look in the SampleCode/Networking/Facebook you can set the right syntax which is:

                        CFBundleURLTypes =                         {                                 {                                         CFBundleURLSchemes =                                         {                                                 "fbXXXXXXXXX",  -- replace XXXXXXXXX with your facebook appId                                                                                          }                                 }                         }

Notice that CFBundleURLSchemes is a table inside of an unnamed table inside of CFBundleURLTypes.

Rob

ahh perfect that worked :slight_smile:

thanks