I had got the Enterprise Developer Account , manage entitlements(com.apple.developer.arkit.barcode-detection.allow)
Use WWDC24‘s Spatial barcode & QR code scanning example‘s code.
When I run my project, my BarcodeDetectionProvider is ok, but at(for await anchorUpdate in barcodeDetection.anchorUpdates) is break ,I try more times call them ,but is useless.
@Example I call this func startBarcodeScanning at ContentView
var barcodeDetection = BarcodeDetectionProvider(symbologies: [.code39, .qr, .upce])
var arkitSession = ARKitSession()
public func startBarcodeScanning() {
Task {
do {
barcodeDetection = BarcodeDetectionProvider(symbologies: [.code39, .qr, .upce])
await arkitSession.queryAuthorization(for: [.worldSensing])
do
{
try await arkitSession.run([barcodeDetection])
print("arkitSession.run([barcodeDetection])")
}
catch
{
return
}
for await anchorUpdate in barcodeDetection.anchorUpdates
{
switch anchorUpdate.event {
case .added:
print("addEntity(myAnchor: anchorUpdate.anchor)")
addEntity(myAnchor: anchorUpdate.anchor)
case .updated:
print("UpdateEntity")
updateEntity(myAnchor: anchorUpdate.anchor)
case .removed:
print("RemoveEntity")
removeEntity()
}
}
//await loadInfo()
}
}
}