sharedApplicationのcanOpenURLメソッドで、アプリをURLスキームで起動できるか調べます。
起動できるときはsharedApplicationのopenURLメソッドでアプリを起動します。
アプリを起動できないときは、ウェブサイトのURLをopenURLメソッドで開きます。
uses iOSapi.Helpers, Macapi.Helpers;
/// <summary>
/// URLスキームを呼び出す、なければURLを開く
/// </summary>
procedure OpenURLSchemaOrURL(const URLSchema, URL: string);
begin
if TiOSHelper.SharedApplication.canOpenURL(StrToNSUrl(URLSchema)) then
TiOSHelper.SharedApplication.openURL(StrToNSUrl(URLSchema))
else
TiOSHelper.SharedApplication.openURL(StrToNSUrl(URL));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenURLSchemaOrURL(
// Google Maps for iOS アプリのURLスキーム
'comgooglemapsurl://',
// Google Mapのウェブサイト
'https://www.google.co.jp/maps');
end;