iOS AppDelegate - Override for PerformFetch is not available
See original GitHub issueDescription
I’m currently migrating my Xamarin.Forms app to .NET MAUI.
Now I stuck on the BackgroundFetch
on iOS.
In Xamarin I was able to override the PerformFetch
method
public override async void PerformFetch(UIApplication application, Action<UIBackgroundFetchResult> completionHandler)
{
//Console.WriteLine("App is performing background fetch.");
try
{
await service?.RefreshAsync(application, completionHandler);
}
catch(Exception exc)
{
EventManager.LogError(exc, forceReport: true);
}
}
In the .NET MAUI AppDelegate, this method is not available for now.
I searched the docs, but the only thing I found was for Xamarin.Forms. https://docs.microsoft.com/en-us/dotnet/api/uikit.uiapplicationdelegate.performfetch?view=xamarin-ios-sdk-12
Steps to Reproduce
- Try to override the
PerformFetch
method on iOS (AppDelegate)
Version with bug
6.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
Any
Did you find any workaround?
No response
Relevant log output
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
no suitable method found to override
Hi, I am trying to use background service in .NET MAUI app and here is my AppDelegate: using Foundation; using UIKit; ...
Read more >iOS: UIBackgroundFetch - PerformFetch not called
On an iOS device, this method is called unpredictably by the OS. There are many factors that go into how often this method...
Read more >application(_:performFetchWithCompletionHandler:)
Tells the app that it can begin a fetch operation if it has data to download. ... For apps supporting iOS 13 and...
Read more >Updating data in the background
Enter the following code, again, in the AppDelegate class: private int updateCount; public override void PerformFetch (UIApplication ...
Read more >Utilizing the iOS Background with Xamarin: Part 1 - Atomic Spin
Implement the fetch handler. The final step is to implement the PerformFetch delegate method in your AppDelegate declaration. This is the method ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@g0dpain Can you try something like this? Notice the Export tag and the lack of override. I’m able to call PerformFetch from an iOS 6 15.4 app. Works on Asp.net 7 and iOS 16 as well.
Added this to FinishedLaunching.
@jfversluis any chance that the attached PR will be merged soon? Thank you!