Post

Replies

Boosts

Views

Activity

Reply to CLMonitor related crash - EXC_BAD_ACCESS (SIGSEGV)
Thanks for your answer Here are more details about the issue: I have another thread having CLMonitor in its stacktrace: Thread 3: 0 libsystem_kernel.dylib 0x00000001d97f63e4 kevent_id + 8 1 libdispatch.dylib 0x000000019115cb00 _dispatch_kq_poll + 228 (event_kevent.c:760) 2 libdispatch.dylib 0x000000019115d50c _dispatch_event_loop_wait_for_ownership + 436 (event_kevent.c:2236) 3 libdispatch.dylib 0x0000000191149a20 __DISPATCH_WAIT_FOR_QUEUE__ + 340 (queue.c:1704) 4 libdispatch.dylib 0x00000001911495e8 _dispatch_sync_f_slow + 148 (queue.c:1799) 5 CoreLocation 0x0000000196df4a2c -[CLMonitor _getMonitoringRecords] + 188 (CLMonitor.mm:179) 6 libswiftCoreLocation.dylib 0x000000021680ae54 CLMonitor.init(_:) + 84 (CLMonitor.swift:281) 7 libswiftCoreLocation.dylib 0x000000021680a991 CLMonitor.__allocating_init(_:) + 1 (CLMonitor.swift:0) 8 MyModule 0x0000000103918f55 closure #1 in MyService.setupTask() + 1 (MyService.swift:33) 9 MyModule 0x00000001039145c1 $sxIeAgHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TATQ0_ + 1 (/<compiler-generated>:0) 10 libswift_Concurrency.dylib 0x0000000194b47e39 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1 (Task.cpp:497) no other thread mention CoreLocation or CLMonitor except these 2 threads. and here is what my setupTask function look like func setupTask() { self.myTask = Task(priority: .high) { if #available(iOS 18.0, *) { // create my session } let monitor = await CLMonitor(myIdentifier) self.myMonitor = monitor for try await event in await monitor.events { if event.state == .unsatisfied { let record = await monitor.record(for: event.identifier) // use record condition and lastEvent } else if event.state == .satisfied { let record = await monitor.record(for: event.identifier) // use record condition and lastEvent } } } }
Dec ’24