Ios13: performFetchWithCompletionHandler not getting called anymore

1k views Asked by At

I notice a strange bug today, my performFetchWithCompletionHandler is not getting called anymore in my iOS 13 iPhone (And it's was working perfectly in my old iOS 11 when I implemented it)

In Delphi this is how I register :

class_addMethod(objc_getClass('DelphiAppDelegate'), sel_getUid('application:performFetchWithCompletionHandler:'), @TMyForm.performFetchWithCompletionHandler, 'v@:@@');

SharedApplication.setMinimumBackgroundFetchInterval(300);

class procedure TMyForm.performFetchWithCompletionHandler(self: id; _cmd: SEL; application: PUIApplication; completionHandler: id);
begin
   //do the stuff
end;

but I wait one full day and my performFetchWithCompletionHandler was never called :( something change in iOS 13 regarding performFetchWithCompletionHandler?

2

There are 2 answers

1
Bosshoss On

performFetchWithCompletionHandler is deprecated in iOS13, you can check : https://dzone.com/articles/how-to-update-app-content-with-background-tasks-us

0
DzungPV On

Late answer but it will work if you target ios version lower than 13, I have an app using Background app refresh and it still works like a charm in iOS 16. But better migrate to new frameworks: https://developer.apple.com/videos/play/wwdc2019/707/