【发布时间】:2014-08-01 19:39:02
【问题描述】:
我正在尝试使用 delphi Firemonkey 开发一个 iphone 应用程序。如果有新数据发送通知,我需要每 x 分钟下载一个 xml 并处理它。如果应用程序正在使用中,这很容易,但是当应用程序处于后台时,我找不到使用此过程的方法....
请帮帮我...
Tnx 很多...但我不能这样做.... 这是我最简单但不起作用的代码……我的错误是什么???
procedure TForm1.Button1Click(Sender: TObject);
var
IdHTTP1 : TIdHTTP;
MyFile : TFileStream;
Notification: TNotification;
UIApp : UIApplication;
begin
UIApp := TUIApplication.Wrap(TUIApplication.OCClass.sharedApplication);
UIApp.setIdleTimerDisabled(True);
TThread.CreateAnonymousThread(procedure ()
var
I: Integer;
Total: Integer;
begin
Total := 0;
while true do
begin
// Carico l'XML
MyFile:= TFileStream.Create(TPath.GetDocumentsPath + TPath.DirectorySeparatorChar+'listticket',fmCreate);
IdHTTP1 := TIdHTTP.Create(nil);
IdHTTP1.Get('http://www.google.com', MyFile);
IdHTTP1.Free;
MyFile.Free;
end;
sleep(5*60*1000);
TThread.Synchronize (TThread.CurrentThread,
procedure ()
begin
end);
end).Start;
end;
【问题讨论】:
标签: ios delphi background firemonkey