You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

拍摄RAW/JPEG照片时出现AVFoundation错误,请求诊断支持

Troubleshooting AVFoundation Capture Errors (-11800 / -12686) When Shooting RAW/JPEG

Let's break down the error you're seeing first, since it gives us key clues:

Error capturing photo: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (42686), NSLocalizedDescription:The operation could not be completed, NSUnderlyingError=0x1c804bfa0 {Error Domain=NSOSStatusErrorDomain Code=-12686 "(null)"}}

The -11800 is a generic AVFoundation failure, but the underlying -12686 OSStatus code is the real hint—it almost always relates to media encoding issues or resource limits when capturing both RAW and JPEG. Here's how to fix this:

1. Validate RAW Capture Support and Session Configuration

First, confirm two critical things:

  • Your device actually supports RAW capture (older iPhones pre-6s, some iPads, and older Macs don't offer this feature).
  • Your app's AVCapturePhotoOutput is set up correctly to handle both RAW and JPEG. Mixing incompatible formats here is a common culprit. For example, here's a proper way to configure dual-format capture:
    let photoOutput = AVCapturePhotoOutput()
    // Check if RAW is available for the device
    guard let rawFormat = photoOutput.availableRawPhotoPixelFormatTypes.first else {
        // Handle devices that don't support RAW capture
        return
    }
    // Configure settings for both RAW and JPEG output
    let photoSettings = AVCapturePhotoSettings(
        rawPixelFormatType: rawFormat,
        processedFormat: [AVVideoCodecKey: AVVideoCodecType.jpeg]
    )
    photoOutput.capturePhoto(with: photoSettings, delegate: self)
    
    Double-check that you're not using conflicting format keys or unsupported combinations in your capture settings.

2. Free Up Memory and Storage

RAW files are significantly larger than JPEGs, and capturing both can strain your device's resources:

  • Close all background apps to free up RAM—AVFoundation needs substantial memory to process RAW data in real time.
  • Check your device's storage space. If it's nearly full, the system can't write the large RAW file to disk. Aim for at least 10GB of free space when shooting RAW.

3. Update Software

Outdated software is a frequent cause of AVFoundation bugs:

  • Update your iOS/macOS to the latest stable version—Apple regularly patches media capture issues in OS updates.
  • Ensure your app is using the latest SDK and has all pending updates applied.

4. Reset Permissions and Capture Session

Glitches in camera permissions or stale session state can cause unexpected errors:

  • Go to Settings > Privacy & Security > Camera, revoke access for your app, then re-enable it to reset the permission state.
  • In your app, avoid reusing a stale capture session object. Instead, tear down all inputs/outputs and reinitialize the session from scratch if you're seeing persistent errors.

5. Rule Out Hardware Issues

Test with the default Camera app:

  • If your device supports RAW + JPEG capture, try shooting in that mode with the stock app. If you get the same error, this points to a hardware problem—reach out to Apple support. If the stock app works, the issue is specific to your app's implementation.

The truncated second error (Error capturing photo: Error Domain=AVFou...) is almost certainly related to the same root cause, so focus on the steps above first. If you're still stuck, share more details like your device model, OS version, and relevant code snippets from your capture setup.

内容的提问来源于stack exchange,提问作者Gizmodo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 10:26:34