Swift-SMART
Swift-SMART copied to clipboard
EXC_BAD_ACCESS
Hi!
When using the SMART classes, I encounter a EXC_BAD_ACCESS.

This happens both in the Demo project (regardless of the data source) and with a small own test app:
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let myEndpoint = "https://hapi.fhir.org/baseDstu3"
//var myFhirUrl = myEndpoint + "/Observation?patient=3352608&category=laboratory"
let smart = Client(
baseURL: URL(string: myEndpoint)!,
settings: [:
]
)
smart.authProperties.granularity = .tokenOnly
smart.authorize() { patient, error in
if nil != error { //} || nil == patient {
}
else {
Observation.search(["patient": "3352608", "category": "laboratory"])
.perform(smart.server) { bundle, error in
if nil != error {
}
else {
}
}
}
}
}
}
This gives the same exception:
let server = FHIRMinimalServer(baseURL: URL(string: "https://hapi.fhir.org/baseDstu3/")!)
Observation.search(["patient": "3352608", "category": "laboratory"])
.perform(server) { bundle, error in
// ...
}
Try enabling "Thread Sanitizer" in build settings.
Thanks for the feedback. I've enabled the Thread Sanitizer for my Build scheme. This caused the exception to disappear. Should I use the Thread Sanitizer all the time?
https://developer.apple.com/documentation/code_diagnostics/thread_sanitizer/enabling_the_thread_sanitizer
We should fix the root issue, enabling the sanitizer is just a workaround. :)
Makes sense :-) Can I help?
PRs are always welcome!!
I've seen this happen only on xcode9.3 simulators. No error on testing on Device (11.3) . (With thread sanitizer disabled)