Un expected behaviour with Background fetch

Hello,


I've been having a lot of problems with background fetch, mainly un-determined behaviuor, even when removed background fetching cabilities it is still happenning!


so in order to remove background fetching completely, i have removed:

- The `plist` flag for `UIBackgroundMode` `fetch`

- `

performFetchWithCompletionHandler
` from app delegate


and then i had put a tracking event that triggers only if the app is in

UIApplicationStateBackground

and i can still the event tracked on both debug and production, so what could be the problem here ? or what is needed more to prevent background fetches completely ?


Thank you.

I don’t understand you concern here. By definition a background fetch is the system calling your

-performFetchWithCompletionHandler:
method. If you’ve removed that method, you can’t possibly get a background fetch.

then i had put a tracking event that triggers only if the app is in

UIApplicationStateBackground

That only confirms that your app was running in the background. An app can run in the background for a wide variety of reasons, so it’s hard to draw any conclusions from that data point. For example, if your app overrides the

-applicationDidEnterBackground:
method (or, equivalently, handles the
UIApplicationDidEnterBackgroundNotification
notification), you’ll find that the state is
UIApplicationStateBackground
when that code runs.

Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

—
WWDC runs Mon, 4 Jun through to Fri, 8 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face.

Thanks for the response @eskimo, but i'am still a bit confused, i do have the `backgroundFetch` flag removed from `Info.plist`, and no `performFetchWithCompletionHandler` in `AppDelegate` , how can the app even wake in the background ?

the only thing related to that in my app is listining to `

UIApplicationDidEnterBackgroundNotification
` by 3rd party library, could that be a reason to enter background state given the above ?


Thank you.

how can the app even wake in the background ?

There are lots of other ways that your app might be running in the background, so many that it’s hard to give a definitive list. To say more I’d have to know the context in which you saw the

applicationState
property being
UIApplicationStateBackground
.

Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I have the same problem,have you resolve this problem?