CJC Delphi 技巧馆's Archiver

cjc Posted at 2013-7-12 15:35

NSOpenURL (IOS)

uses Macapi.CoreFoundation, Macapi.Foundation, Macapi.AppKit;

procedure NSOpenURL(const AUrl: string);
var
  CF1, CF2: CFStringRef;
  URLObj: NSURL;
  Workspace: NSWorkspace;
begin
  CF2 := nil;
  CF1 := CFStringCreateWithCharactersNoCopy(nil, PChar(AUrl),
    Length(AURL), kCFAllocatorNull);
  try
    CF2 := CFURLCreateStringByAddingPercentEscapes(
      kCFAllocatorDefault, CF1, nil, nil, kCFStringEncodingUTF8);
    Workspace := TNSWorkspace.Wrap(TNSWorkspace.OCClass.sharedWorkspace);
    URLObj :=
TNSURL.Wrap(TNSURL.OCClass.URLWithString(TNSString.Wrap(CF2)));
    Workspace.openURL(URLObj);
  finally
    if CF2 <> nil then CFRelease(CF2);
    if CF1 <> nil then CFRelease(CF1);
  end;
end;

Page: [1]
CJC好玩背单词最新版本 - 是目前最好的背单词软件,游戏好玩,功能强大,词库众多,还有真人语音,免费下载,免费试用 !

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.