Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB15877420: App randomly be terminated due to Capture Application Requirements Unmet #587

Open
JuniperPhoton opened this issue Nov 23, 2024 · 0 comments

Comments

@JuniperPhoton
Copy link

  • Date: 2024-11-23
  • Resolution: Open
  • Area: Media/Camera/AVFoundation
  • OS: iOS 18.2 Beta 4
  • Type: Incorrect/Unexpected Behavior

Details

Description

I also created a post in the forum: https://developer.apple.com/forums/thread/769024#769024021

Hi. I encounter some random crashes of my camera app. After some investigations, I found that it's terminated by the system and the crash log did be generated but the information is not quite useful, and here is the log found via the Console app.

Termination & Crash log

"Camera not actively used; AVCaptureEventInteraction not installed":

Received termination request from [osservice<com.apple.SpringBoard>:10931] on <RBSProcessPredicate <RBSProcessInstancePredicate| [app<com.juniperphoton.PhotonCam]>> with context <RBSTerminateContext| explanation:Capture Application Requirements Unmet: "Camera not actively used; AVCaptureEventInteraction not installed" reportType:CrashLog maxTerminationResistance:Interactive>
The crash log exported from the device will have some common information like:

It's a EXC_CRASH (SIGKILL) type with no termination reason.

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: RUNNINGBOARD 0 

It's triggered by the main thread, but it seems to be waiting for an event to process.

Triggered by Thread:  0

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib        	       0x1ee165788 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1ee168e98 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x1ee168db0 mach_msg_overwrite + 424
3   libsystem_kernel.dylib        	       0x1ee168bfc mach_msg + 24
4   CoreFoundation                	       0x19cbe47f4 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x19cbe3ea0 __CFRunLoopRun + 1212
6   CoreFoundation                	       0x19cc36274 CFRunLoopRunSpecific + 588
7   GraphicsServices              	       0x1e9d6d4c0 GSEventRunModal + 164
8   UIKitCore                     	       0x19f783480 -[UIApplication _run] + 816
9   UIKitCore                     	       0x19f3a9410 UIApplicationMain + 340
10  UIKitCore                     	       0x19fae4bb0 0x19f394000 + 7670704
11  PhotonCam                     	       0x1002e7e3c 0x1002cc000 + 114236
12  dyld                          	       0x1c2d5ade8 start + 2724

Address size fault on the main thread

Thread 0 crashed with ARM Thread State (64-bit):
    ...
   far: 0x0000000000000000  esr: 0x56000080  Address size fault

I have once tried to reproduce this issue when the app is attached with debugger, and it says:

Terminated due to signal 9

When the crash or termination happened, the app:

  • No AVCaptureSession is running.
  • The app is in the foreground and users are interacting with some functions like viewing photos or editing photos in the app. When users exit the camera view, like entering the gallery or settings, the camera session will be stopped.
  • Both TestFlight and Debug build will have the same issue.
    No 3rd party crash reporter is installed(I deliberately disable it in Debug build and TestFlight build)
  • It has adopted the LockedCameraCapture, but current it's running on the main app target(if not, my app will have a button of unlock, so I can confirm about this).
  • Also, when it comes to the memory consumption, there is no JetsamEvent around the crash time.

Device and app information

Additionally, some information about the tech stack and the current state of my device and my app:

  • iPhone 16 Pro with iOS 18.2 Beta 3.
  • The app is a camera based app(it's PhotonCam and you can find it on the App Store), its main functionality is the camera feature using AVFoundation + Core Image + Metal to deliver camera functionality.
  • It has adopted the Camera Control, AVCaptureEventInteraction and LockedCameraCapture features.
  • If I remember it right, it occurs in iOS 18.1 Release build, but currently I have no such device to confirm. But in iOS 17.x the issue has never happened.
  • Regarding to this termination, on top of my head is the "watchdog" mechanism that will terminate the process that is running on the LockedCameraCapture feature. However I can make sure that currently the app is running as the main target on the home screen.

Reproduction

I have already found the way to reproduce this issue:

  1. Enter some pages on your app that don't access the camera, like the settings page or gallery page.
  2. Put the app in the background, and launch it using the Camera Control.
  3. After launching the app, the app will still stay in the last page that doesn't use camera.
  4. Wait for a few seconds and the app will be terminated with the log:

"Camera not actively used; AVCaptureEventInteraction not installed":

Received termination request from [osservice<com.apple.SpringBoard>:10931] on <RBSProcessPredicate <RBSProcessInstancePredicate| [app<com.juniperphoton.PhotonCam]>> with context <RBSTerminateContext| explanation:Capture Application Requirements Unmet: "Camera not actively used; AVCaptureEventInteraction not installed" reportType:CrashLog maxTerminationResistance:Interactive>

Unlike the LockedCameraCapture, which requires to access the camera and I can understand. But launching the app via Camera Control when the device is unlocked doesn’t have to use the camera feature.

I have created a minimal demo to reproduce this issue.

Files

LockedCameraCaptureExtensionDemo.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant