UIApplicationDidEnterBackgroundNotification incorrectly sent twice

Number:rdar://31154381 Date Originated:3/20/2017
Status:Open Resolved:
Product:iOS + SDK Product Version:10.2.1
Classification:Serious Bug Reproducible:Always

UIApplicationDidEnterBackgroundNotification incorrectly sent twice when an app with a background task is killed from Springboard

Steps to Reproduce:
Set up an app that has some background work to do, is capturing audio or otherwise running in the background.
Background it -- it receives UIApplicationDidEnterBackgroundNotification.
Kill the app from Springboard before it finishes its background work -- it receives another UIApplicationDidEnterBackgroundNotification

Expected Results:
Already backgrounded apps should not be sent a redundant backgrounding notification. If there is a need to tell background apps that they've been told to knock it off, there should be another notification for this.

Actual Results:
Application lifecycle listeners have to be wary and not mess stuff up when they are lied to by the system.

iOS 10.2.1

It also appears that UIApplicationWillEnterForegroundNotification is received by listeners more than once when an app comes from background to foreground after it has been suspended. This is still happening on iOS 10.2.1

iPhone 7, AT&T



Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!