I had a similar error, the issue was caused by multiple threads modifying the array at the same time. Wrapping the append calls in a serial dispatch queue solved it for me.
let serialQueue = DispatchQueue(label: "myqueue")
serialQueue.sync {
exporters.append(exporter)
}