Skip to content

Crash when backgrounding app #23

@rotarytony

Description

@rotarytony

App Crash When Backgrounded on SDK Version 0.6.2

Description

Using Contentsquare SDK version 0.6.2, our app crashes when it enters the background.

Reproduction Steps

  1. Launch the app.
  2. Send the app to the background (e.g., via Home button or swipe).
  3. Crash occurs immediately.

Minimal Reproducible Example

import SwiftUI
import HeapSwiftCore
import HeapIOSAutocapture

@main
struct TestAppApp: App {
  @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

  var body: some Scene {
    WindowGroup {
      Text("Hello world")
    }
  }
}

class AppDelegate: UIResponder, UIApplicationDelegate {

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    Heap.shared.startRecording("1142558753")
    Heap.iOSAutocaptureSource.register(isDefault: true)
    return true
  }

  func applicationDidEnterBackground(_ application: UIApplication) {
    Heap.shared.stopRecording()
  }
}

Crash

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSBundle autostartEnabled]: unrecognized selector sent to instance 0x60000210fcf0'
*** First throw call stack:
(
    CoreFoundation                      0x00000001804b70ec __exceptionPreprocess + 172
    libobjc.A.dylib                     0x000000018008ede8 objc_exception_throw + 72
    CoreFoundation                      0x00000001804ccc54 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
    CoreFoundation                      0x00000001804bb3ec ___forwarding___ + 1268
    CoreFoundation                      0x00000001804bdb0c _CF_forwarding_prep_0 + 92
    TestApp.debug.dylib                 0x0000000101d4ba14 ...
    ...
    libsystem_pthread.dylib             0x000000010094598c start_wqthread + 8
)
libc++abi: terminating due to uncaught exception of type NSException
Screen.Recording.2025-06-02.at.11.37.33.AM.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions