iOS OpenURL – Not just for HTTP URLs


Anders just recently blogged about how to open Safari from your iOS Delphi app and showed how to incorporate Cleggy’s Apple.Utils.pas unit to make it just as simple as:
The interesting point is now, that this would also work for other apps. If you want to open the iPhone Messenger for example, then just do this:
This also works with 3rd party Apps, you can open the Facebook app like this:
But what if the App is not installed or not available (like on the iOS simulator)? OpenURL will do just nothing, which is kind of stupid, you might want to do something as alternative probably.
For that reason there is CanOpenURL (which is not yet in Cleggy’s unit). That just returns true or false indicating if the required app is available. This is how you would implement/call it –
Update: CanOpenURL is now in DX.Library


function CanOpenURL(AURL: string):boolean;
result := SharedApplication.canOpenURL(StringToNSUrl(AURL));

Here are a couple of links where you find information about available URL schemes:

Apple URL Schemes
Misc URL Schemes from AKOSMA Wiki

Tweet This!

Share this on

Digg this!

Share this on Reddit

Get Shareaholic

Comments are closed.