Xcode 16 crashes my Vision Pro Object Tracking App

I created an Object & Hand Tracking app based on the sample code released here by Apple.

https://developer.apple.com/documentation/visionos/exploring_object_tracking_with_arkit

The app worked great and everything was fine, but I realized I was coding on Xcode 16 beta 3, so I installed the latest Xcode 16 from the App Store and tested by app there, and it completely crashed. No idea why. Here is the console

dyld[1457]: Symbol not found: _$ss13withTaskGroup2of9returning9isolation4bodyq_xm_q_mScA_pSgYiq_ScGyxGzYaXEtYas8SendableRzr0_lF
  Referenced from: <3AF14FE4-0A5F-381C-9FC5-E2520728FC65> /private/var/containers/Bundle/Application/F74E88F2-874F-4AF4-9D9A-0EFB51C9B1BD/Hand Tracking.app/Hand Tracking.debug.dylib
  Expected in:     <2F158065-9DC8-33D2-A4BF-CF0C8A32131B> /usr/lib/swift/libswift_Concurrency.dylib

It was working perfectly fine on Xcode 16 beta 3, which makes me think it's an Xcode 16 issue, but no idea how to fix this. I also installed Xcode 16.2 beta (the newest beta) but same error.

Please help if anyone knows what is wrong!

Answered by swakitaki in 811157022

I found the solution so keeping it up in case in helps anyone else. I had this code:

        await withTaskGroup(of: Void.self) { group in
            for file in referenceObjectFiles {
                let objectURL = Bundle.main.bundleURL.appending(path: file)
                group.addTask {
                    await self.loadReferenceObject(objectURL)
                    await self.finishedOneFile()
                }
            }
        }

and it worked when I replaced it with this:

        for file in referenceObjectFiles {
            let objectURL = Bundle.main.bundleURL.appendingPathComponent(file)
            Task {
                await self.loadReferenceObject(objectURL)
                await self.finishedOneFile()
            }
        }

I guess you can't use withTaskGroup in Xcode 16...

Accepted Answer

I found the solution so keeping it up in case in helps anyone else. I had this code:

        await withTaskGroup(of: Void.self) { group in
            for file in referenceObjectFiles {
                let objectURL = Bundle.main.bundleURL.appending(path: file)
                group.addTask {
                    await self.loadReferenceObject(objectURL)
                    await self.finishedOneFile()
                }
            }
        }

and it worked when I replaced it with this:

        for file in referenceObjectFiles {
            let objectURL = Bundle.main.bundleURL.appendingPathComponent(file)
            Task {
                await self.loadReferenceObject(objectURL)
                await self.finishedOneFile()
            }
        }

I guess you can't use withTaskGroup in Xcode 16...

Xcode 16 crashes my Vision Pro Object Tracking App
 
 
Q