First, I start add the provider to the session:
do {
if WorldTrackingProvider.isSupported {
try await session.run([worldTracking])
print("World Tracking Provider Started.")
} else {
print("World Tracking not supported >.>")
}
} catch {
print("ARKitSession error:", error)
}
Then I try to add a world anchor:
var task: Task<Void, Never>?
func trackAnchor(_ anchor: WorldAnchor) {
task = Task {
do {
try await self.worldTracking.addAnchor(anchor)
print("Added anchor to tracking provider!")
} catch {
print("Error: \(error)")
}
}
}
The awaited call never finishes. A breakpoint is not hit and errors are not thrown.
As such, when the app is quit and restarted, the system does not recover the tracked world anchor.
Any ideas?