Skip to main content
Code samples

Simulator Support

Supported Configurationsโ€‹

HostSimulatorSupportedNotes
Apple Silicon Mac (M1/M2/M3/M4)iOS arm64 SimulatorYesFull noise cancellation
Intel MaciOS arm64 Simulator (Rosetta)YesRequires Rosetta enabled
Intel MaciOS x86_64 SimulatorNoarm64 binary only

Enable Rosetta on Intel Macโ€‹

  1. In Xcode, go to Product โ†’ Destination
  2. Select Rosetta Simulator (any iPhone model)

Or set it project-wide: Project Settings โ†’ Build Settings โ†’ Architectures โ†’ Excluded Architectures โ†’ add x86_64 for the simulator SDK.

Alternatively, add to your Podfile or Xcode project's xcconfig:

EXCLUDED_ARCHS[sdk=iphonesimulator*] = x86_64

What Happens on Unsupported Simulatorโ€‹

On an x86_64 (Intel) simulator without Rosetta:

  1. Build succeeds โ€” the linker finds the arm64-simulator slice but skips it
  2. Launch crashes at df_create โ€” NCKitError.libraryInit is thrown (if caught), or the process crashes with SIGABRT (if not)
do {
let processor = try NCKitProcessor(modelURL: modelURL)
} catch NCKitError.libraryInit {
#if targetEnvironment(simulator)
print("Simulator: use Apple Silicon Mac or Rosetta for NC support")
#else
throw NCKitError.libraryInit
#endif
}

Simulator-Safe Architecture Patternโ€‹

final class NCKitManager {
private var processor: NCKitProcessor?

var isAvailable: Bool { processor != nil }

func initialize() {
do {
let modelURL = try NCKitModelLocator.modelTarGzURL()
processor = try NCKitProcessor(modelURL: modelURL)
} catch {
print("NCKit unavailable: \(error)")
}
}

func denoise(inputURL: URL, outputURL: URL) throws {
guard let proc = processor else {
try FileManager.default.copyItem(at: inputURL, to: outputURL)
return
}
try NCKitFileProcessor.processFile(
inputURL: inputURL,
outputURL: outputURL,
processor: proc
)
}
}

Physical Device Testingโ€‹

For full noise cancellation testing, always use a physical iOS device (iPhone or iPad).