1

I am using Delphi 10

In older RAD Studio Versions for iOS it was possible to use openURL with SharedApplication in Apple.Utils.pas

But Apple.Utils.pas cannot be found, in what unit can I find SharedApplication and openURL ?

Peter-John Jansen
  • 603
  • 1
  • 7
  • 26

1 Answers1

0

You can find SharedApplication and openURL in iOSapi.UIKit, you will also need iOSapi.foundation, Macapi.Helpers

And to use it, you will need a SharedApplication Object and a NSURL object that contains the address you would like to navigate to

uses iOSapi.UIKit,iOSapi.foundation, Macapi.Helpers
var
    App : UIApplication;
    url : NSurl;
begin
    App := TUIApplication.Wrap(TUIApplication.OCClass.sharedApplication);
    url := TNSURL.Wrap(TNSURL.OCClass.URLWithString(StrToNSStr('http://www.stackoverflow.com')));
    if App.canopenURL(url) then //Check if there is a default App that can open the URL
      App.openURL(url) else
        ShowMessage('Can not open URL');
end;
Peter-John Jansen
  • 603
  • 1
  • 7
  • 26
  • Hey , thanks for your answer but when i try to implement UIKit ore foundation ore some other Units i get an error : "Unit-Name (for example )IOSapi.UIKit cannot be resolved . But i am sure the unit is available because i checked it out and found all the units at C:\Program Files (x86)\Embarcadero\Studio\17.0\source\rtl\ios –  Feb 10 '16 at 15:49
  • Check you library paths, but just copying IOSapi.UIKIT.pas to your project folder would also work – Peter-John Jansen Feb 11 '16 at 08:16