Short answer

If your app stops with "signal SIGABRT" the moment it opens the camera or the photo library, check Info.plist for that feature's usage description. Apple's documentation marks NSCameraUsageDescription and NSPhotoLibraryUsageDescription as required for apps that use those APIs, and says the system terminates a capture app without the right key. Projects without an Info.plist file set the same keys as INFOPLIST_KEY_ build settings. To let people pick a photo, you may not need the photo library key at all: Apple says PHPickerViewController needs no photo library permission. A short Swift script below finds missing or empty keys.

SWIFT TIPS · XCODE · PRIVACY

First posted on January 6, 2018, as "Swift error : Thread 9: signal SIGABRT how to solve it Ask (for enable Photo)". Rewritten on November 18, 2026. The checker script was run on a Mac with Swift 6.2.3 (Xcode 26.2) on macOS 26.0.1, against a sample project made for the test. The picker code was type-checked against the iOS 26.2 SDK in Swift 5 and Swift 6 modes with iOS 15 and iOS 26.2 as deployment targets, but not run on a device. Nothing on this Mac asked for camera or photo access.

The 2018 post opened with a question: an app built in an online Swift course stopped with "Thread 9: signal SIGABRT" when it used the photo library, and the debugger pointed at an assembly line, not at any Swift code. The answer was one Info.plist entry: click the plus button and add "Privacy - Photo Library Usage Description". The post also noted the camera key, with values like $(PRODUCT_NAME) camera use, and steps for getting pictures into the Simulator by saving them from Safari.

That answer is still the fix for this crash. This rewrite explains why it happens, which key goes with which feature, where the keys live in projects made with current Xcode, a script that checks them for you, and a way to pick photos that needs no photo permission at all.

Why the app stops

SIGABRT means the process was told to abort. The debugger stops on whichever thread was running at that moment, which is why the 2018 report said thread 9 and yours may say thread 1, and why the highlighted line is often system code you didn't write. The useful information is in the console just above it.

For privacy-protected hardware and data, the usage description is a condition of access. Apple's page on capturing media says an app must have the right key in its Info.plist before it asks for permission or uses a capture device, "otherwise, the system terminates your app". The key's text is also what the person reads in the permission prompt, so an empty string is as bad as no key.

Which key goes with which feature

Each key's Apple documentation says it's required when your app uses APIs that access that data:

  • Camera: NSCameraUsageDescription, for AVCaptureDevice, AVCaptureSession or a UIImagePickerController with the camera source.
  • Reading the photo library: NSPhotoLibraryUsageDescription, for PhotoKit APIs with read or write access.
  • Only adding photos: NSPhotoLibraryAddUsageDescription. Apple's documentation says to use this one instead if the app only adds to the library and doesn't read it.
  • Location while in use: NSLocationWhenInUseUsageDescription.
  • Microphone: NSMicrophoneUsageDescription.
  • Contacts: NSContactsUsageDescription.

Where the keys live now

Projects created with recent Xcode versions often have no Info.plist file. Xcode generates it at build time when GENERATE_INFOPLIST_FILE is on, and Apple's build settings reference lists a setting for each privacy key, such as INFOPLIST_KEY_NSCameraUsageDescription. In Xcode both kinds show up in the target's Info tab. So if you search the project for an Info.plist and find nothing, the keys may still be set, as build settings in project.pbxproj.

A script that checks a project

This script looks through your Swift files for APIs that need a key, then looks for each key in Info.plist files and in INFOPLIST_KEY_ build settings. It skips Pods, Carthage and build folders, and treats an empty description as missing:

// privacy_check.swift: lists the privacy keys your Swift code needs and where each one is set.
// Run from Terminal:  swift privacy_check.swift /path/to/YourProject
import Foundation

// API names to look for, and the Info.plist key each one needs.
let rules: [(pattern: String, key: String)] = [
    ("AVCaptureDevice", "NSCameraUsageDescription"),
    ("AVCaptureSession", "NSCameraUsageDescription"),
    ("sourceType = .camera", "NSCameraUsageDescription"),
    ("PHPhotoLibrary.requestAuthorization(for: .addOnly", "NSPhotoLibraryAddUsageDescription"),
    ("UIImageWriteToSavedPhotosAlbum", "NSPhotoLibraryAddUsageDescription"),
    ("PHPhotoLibrary.requestAuthorization(for: .readWrite", "NSPhotoLibraryUsageDescription"),
    ("PHPhotoLibrary.requestAuthorization {", "NSPhotoLibraryUsageDescription"),
    ("PHAsset.fetchAssets", "NSPhotoLibraryUsageDescription"),
    ("requestWhenInUseAuthorization", "NSLocationWhenInUseUsageDescription"),
    ("AVAudioRecorder", "NSMicrophoneUsageDescription"),
    ("CNContactStore", "NSContactsUsageDescription"),
]

let root = URL(fileURLWithPath: CommandLine.arguments.dropFirst().first ?? ".")
let skip = ["Pods", "Carthage", "DerivedData", "build", ".build", ".git"]
var needed: [String: Set<String>] = [:]   // key -> files that need it
var foundIn: [String: Set<String>] = [:]  // key -> where it's set

let files = FileManager.default.enumerator(at: root, includingPropertiesForKeys: nil)!
for case let url as URL in files {
    if skip.contains(url.lastPathComponent) { files.skipDescendants(); continue }
    let name = url.lastPathComponent
    if url.pathExtension == "swift", let text = try? String(contentsOf: url, encoding: .utf8) {
        for rule in rules where text.contains(rule.pattern) {
            needed[rule.key, default: []].insert(name)
        }
    } else if name == "Info.plist" || name.hasSuffix("-Info.plist"),
              let data = try? Data(contentsOf: url),
              let plist = try? PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any] {
        for (key, value) in plist where key.hasSuffix("UsageDescription") {
            let text = (value as? String) ?? ""
            foundIn[key, default: []].insert(text.isEmpty ? "\(name) (EMPTY)" : name)
        }
    } else if name == "project.pbxproj", let text = try? String(contentsOf: url, encoding: .utf8) {
        // Projects with GENERATE_INFOPLIST_FILE keep these as build settings: INFOPLIST_KEY_<key> = "...";
        let regex = try! NSRegularExpression(pattern: #"INFOPLIST_KEY_(NS\w+UsageDescription) = ("[^"]*"|[^;]*);"#)
        for m in regex.matches(in: text, range: NSRange(text.startIndex..., in: text)) {
            let key = String(text[Range(m.range(at: 1), in: text)!])
            let value = text[Range(m.range(at: 2), in: text)!].trimmingCharacters(in: CharacterSet(charactersIn: "\" "))
            foundIn[key, default: []].insert(value.isEmpty ? "build settings (EMPTY)" : "build settings")
        }
    }
}

var problems = 0
for key in Set(needed.keys).union(foundIn.keys).sorted() {
    let users = needed[key, default: []].sorted().joined(separator: ", ")
    let places = foundIn[key, default: []].sorted().joined(separator: ", ")
    let missing = needed[key] != nil && (places.isEmpty || places.contains("EMPTY"))
    if missing { problems += 1 }
    print("\(missing ? "MISSING" : "ok     ")  \(key)")
    print("         used by: \(users.isEmpty ? "-" : users)   set in: \(places.isEmpty ? "-" : places)")
}
print(problems == 0 ? "No missing keys found." : "\(problems) key(s) missing or empty.")
exit(problems == 0 ? 0 : 1)

I made a sample project with four Swift files: one using the camera, one asking for read-write photo access, one asking for location, and one with an audio recorder. Its Info.plist had a camera description and an empty microphone description, and the location description was a build setting. A fifth file using Contacts sat inside a Pods folder. The run:

ok       NSCameraUsageDescription
         used by: Scanner.swift   set in: Info.plist
ok       NSLocationWhenInUseUsageDescription
         used by: Stores.swift   set in: build settings
MISSING  NSMicrophoneUsageDescription
         used by: Voice.swift   set in: Info.plist (EMPTY)
MISSING  NSPhotoLibraryUsageDescription
         used by: Gallery.swift   set in: -
2 key(s) missing or empty.
(exit code 1)
  • The camera key was found in Info.plist, and the location key in the build settings.
  • The empty microphone description was reported as missing, because the prompt would show nothing.
  • The photo library key, needed by the read-write request, was missing everywhere. That's the 2018 crash.
  • The Contacts call inside Pods wasn't counted; third-party code is outside your control here. The script exits with status 1 when something is missing, so it can run in a build phase or on a CI server.

The list of API names is short on purpose. Add the ones your app uses; a text search can't follow every way of calling an API.

Picking a photo without the photo permission

Apple's PhotoKit sample on selecting photos says apps don't need to request photo library permission when they use PHPickerViewController or UIImagePickerController, because the picker runs in a separate process and the app only gets the items the person chose. For a profile photo or an attachment, that means no photo prompt and no photo key:

import AVFoundation
import PhotosUI
import UIKit

final class ProfilePhotoViewController: UIViewController, PHPickerViewControllerDelegate,
                                        UIImagePickerControllerDelegate, UINavigationControllerDelegate {
    private let imageView = UIImageView()

    // Choosing from the library: PHPickerViewController runs outside your app and needs no
    // photo library permission, so no NSPhotoLibraryUsageDescription for this.
    func chooseFromLibrary() {
        var config = PHPickerConfiguration()
        config.filter = .images
        config.selectionLimit = 1
        let picker = PHPickerViewController(configuration: config)
        picker.delegate = self
        present(picker, animated: true)
    }

    func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
        picker.dismiss(animated: true)
        guard let provider = results.first?.itemProvider, provider.canLoadObject(ofClass: UIImage.self) else { return }
        provider.loadObject(ofClass: UIImage.self) { [weak self] object, _ in
            guard let image = object as? UIImage else { return }
            DispatchQueue.main.async { self?.imageView.image = image }
        }
    }

    // Taking a photo: needs NSCameraUsageDescription in Info.plist (or the
    // INFOPLIST_KEY_NSCameraUsageDescription build setting) before this runs.
    func takePhoto() {
        guard UIImagePickerController.isSourceTypeAvailable(.camera) else {
            showMessage("This device has no camera.")      // the simulator, for example
            return
        }
        switch AVCaptureDevice.authorizationStatus(for: .video) {
        case .authorized:
            presentCamera()
        case .notDetermined:
            AVCaptureDevice.requestAccess(for: .video) { granted in
                DispatchQueue.main.async { [weak self] in
                    granted ? self?.presentCamera() : self?.showMessage("Camera access was not allowed.")
                }
            }
        case .denied, .restricted:
            showMessage("Allow camera access for this app in Settings to take a photo.")
        @unknown default:
            showMessage("Camera access is not available.")
        }
    }

    private func presentCamera() {
        let camera = UIImagePickerController()
        camera.sourceType = .camera
        camera.delegate = self
        present(camera, animated: true)
    }

    func imagePickerController(_ picker: UIImagePickerController,
                               didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
        imageView.image = info[.originalImage] as? UIImage
        picker.dismiss(animated: true)
    }

    private func showMessage(_ text: String) {
        let alert = UIAlertController(title: nil, message: text, preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: "OK", style: .default))
        present(alert, animated: true)
    }
}
  • The library picker asks for nothing; the person just picks.
  • The camera still needs NSCameraUsageDescription. The code checks the status first and only asks when it's undetermined, then explains what to do if access was refused, instead of opening a camera that shows a black screen.
  • No camera, no crash. isSourceTypeAvailable(.camera) is false on devices without a camera, so the code shows a message instead.

Write descriptions people agree to

App Review guideline 5.1.1 asks that purpose strings clearly and completely describe how you use the data. "MyApp camera use", which is what $(PRODUCT_NAME) camera use becomes, says nothing. "Scan the QR code on a receipt to add it to your expenses" tells the person why, and makes yes more likely.

A quick check for your project

  1. Run the script against your project folder, or search project.pbxproj and every Info.plist for UsageDescription.
  2. Read each description as the person seeing the prompt would. Replace any that only name the app.
  3. Look for photo library requests that only exist to let people pick one picture, and switch them to PHPickerViewController.

What the 2018 version said

The post showed the Info.plist editor with the privacy keys added, including a camera description of "Scan QR code", and the list of privacy keys that opens from the plus button. Its steps for adding photos to the Simulator went through Safari; I didn't run the Simulator for this rewrite. The post ended with a signature line and a LinkedIn link, which I left out.

Xcode's Info.plist editor with privacy keys for the photo library and the camera

The list of Privacy keys in Xcode's Info.plist editor, with Photo Library Usage Description highlighted

Sources