簡體   English   中英

Delphi Firemonkey iOS后台獲取

[英]Delphi Firemonkey ios Background Fetch

我正在嘗試使用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;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM