App gets terminated in background with an assertion (0x8badf00d)

The app generates lots of background termination logs with the 0x8badf00d code and no additional info. System log contains lines like:

Forcing crash report with description: _______:1699 has active assertions beyond permitted time:
<BKProcessAssertion: 0x10223d100; "will present notification" (notificationAction:30s); id:\M-b\M^@\M-&F41DA0DAE03D> (owner: SpringBoard:58)


It usually means that the app fails to call completion handler after receiving a remote notification, but that shouldn't be the case:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    Logger.shared.log("AppDelegate", "remoteNotification: \(userInfo)")
    completionHandler(UIBackgroundFetchResult.noData)
}

But the logs show nothing, and the app would call the completion handler anyway. Additionally, I don't expect the backend to generate any APNS notifications at the moment.

The app also uses VoIP notifications via PushKit, but they don't have any completion handlers, and the VoIP APNS certificate is expired anyway, so there should be none.

The app may generate local notifications using UNNotificationRequest, but there seems to be no completion handlers there either.


I'd appreciate any help.

Replies

I'm seeing this exact same thing! Happens when the device locks automatically, and only on iOS 11.


has active assertions beyond permitted time:
<BKProcessAssertion: 0x10152f2c0; "will present notification" (notificationAction:30s); id:…54E87C91BC3A> (owner: SpringBoard:55)

I think I found the issue. I was using PluggableApplicationDelegate and it doesn't handle callbacks correctly. In particular, if you don't have at least 1 service that responds to a method, it will never call the callback. This PR should fix that: https://github.com/fmo91/PluggableApplicationDelegate/pull/25.

I am also facing same issue:

We are not using remote notifcation.

we are only posting localnotification.

Scenario :

Post some local notification.

go to background and let application suspend

crash is observed.


Console logs:

Sep 25 11:05:53 iPhone5S assertiond[64] <Notice>: [Push To Talk Pl:1675] Forcing crash report with description: ******* Pl:1675 has active assertions beyond permitted time:

<BKProcessAssertion: 0x100b1f010; "will present notification" (notificationAction:30s); id:\M-b\M^@\M-&6D2D99BE4FEE>

(owner: SpringBoard:53)


Stack Trace:

Date/Time:

2017-09-25 11:05:54.0673 +0530

Launch Time:

2017-09-25 10:34:22.2400 +0530

OS Version:

iPhone OS 11.0 (15A372)

Baseband Version:

8.01.00

Report Version:

104


Exception Type: EXC_CRASH (SIGKILL)

Exception Codes: 0x0000000000000000, 0x0000000000000000

Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: Namespace <0xF>, Code 0x8badf00d

Triggered by Thread: 0


Filtered syslog:

None found


Thread 0 name: Dispatch queue: com.apple.main-thread

Thread 0 Crashed:

0 libsystem_kernel.dylib

0x0000000183d64bc4 mach_msg_trap + 8

1 libsystem_kernel.dylib

0x0000000183d64a3c mach_msg + 72

2 CoreFoundation

0x0000000184213ce4 __CFRunLoopServiceMachPort + 196

3 CoreFoundation

0x00000001842118b0 __CFRunLoopRun + 1424

4 CoreFoundation

0x00000001841322d8 CFRunLoopRunSpecific + 436

5 GraphicsServices

0x0000000185fc3f84 GSEventRunModal + 100

6 UIKit

0x000000018d6de880 UIApplicationMain + 208

7 ****

0x0000000100786fa8 0x100780000 + 28584

8 libdyld.dylib

0x0000000183c5656c start + 4

Hi,


We are having the same issue in iOS 11. When posting a local notification and then putting the app in the background + lock the screen we see a crash.

I have filed a bug to Apple. I also created an open radar issue: https://openradar.appspot.com/34788843

Looks like this was closed as a dupe of 33765986. Did you get further word from Apple about it?


In my own testing, this looks like it's fixed in 11.2 beta 3.

I am seeing the same problem with iOS 11.1.1. It happens when posting a local notification and putting the app in the background. I have looked at your log in the radar you created and mine is identical.