Hello, I'm working on a project where I want to run a long running background task (Xamarin forms ios). I used Background task with completion handler, but the problem is, it works only while debugging the application. Here is my code :
Task.Factory.StartNew(() =>
{
DidEnterBackgroundId = UIApplication.SharedApplication.BeginBackgroundTask(() =>
{
UIApplication.SharedApplication.EndBackgroundTask(DidEnterBackgroundId);
});
while (!_backgroundEntryTime)
{
BackgroundUpdates.UpdateCurrentStatus();
BackgroundUpdates.BeginLocalToServerSync();
}
UIApplication.SharedApplication.EndBackgroundTask(DidEnterBackgroundId);
});
can anyone help me with this.