IOS background fetch is not working

I am currently developing an app for iOS with expo SDK-version 32, background fetch is working on expo client app?

Steps to Reproduce

  1. Allow background fetch in app.json
"ios": {
    "infoPlist": {
        "UIBackgroundModes": [
		"location",
		"fetch"
	]

2.register task
await BackgroundFetch.registerTaskAsync(FETCH_BACKGROUND_TASK);
BackgroundFetch.setMinimumIntervalAsync(60);

  1. define task
    TaskManager.defineTask(FETCH_BACKGROUND_TASK, async () => {
    try {
    const now = Date.now();
    setItemLocalStorage(BACKGROUND_TIME_UPDATE, {
    response: now.toString(),
    });
    return BackgroundFetch.Result.NewData;
    } catch (error) {
    return BackgroundFetch.Result.Failed;
    }
    });

Thanks

Hey @saiyam,

Can you ensure you are calling TaskManager globally? If you are, can you elaborate and ideally share the exact error you are getting?

Cheers,
Adam

I did not get any error, my location background is working, but background fetch not running, gobally mean should I use in app.js file ?

As in what is described here: https://docs.expo.io/versions/v32.0.0/sdk/task-manager/#taskmanagerdefinetasktaskname-task

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.