Unfortunately the link that you sent I get an "Unauthorized Access" page when clicking on it, even when signed in with the account holder role.
I can confirm that I am using an immersive space. I've even replaced the barcode detection .task with the task from this sample code (https://developer.apple.com/documentation/visionos/setting-up-access-to-arkit-data) and I have no problem detecting planes in the await update in planeData.anchorUpdates code block. Is there any chance something is wrong with my Enterprise.license file that would cause this?
Also, you mentioned that you've ran my code and it seems to be working just fine. Can you confirm you see the same message that I do in the console when running barcode detection? The ar_barcode_detection_provider_t <0x303ee4a20>: Failed to run provider with transient error code: 1 message?
Post
Replies
Boosts
Views
Activity
My entitlements look great, and there is no issue at compile time with them matching up to what's in the portal. I've confirmed that the Enterprise.license file is included in the target membership for the project.
I've even gone so far as to create an additional project from the Xcode template, used .mixed immersionStyle, and copy the code from the example directly into ImmersiveView.swift. I still get that error message and the app absolutely does not pick up and type of bar code. I've added all the available symbologies, and tried scanning both QR codes and barcodes on the back of an iPhone box and also a standard UPC code, to no avail.
It really seems that the code published (https://developer.apple.com/documentation/visionos/locating-and-decoding-barcodes-in-3d-space) to attempt barcode scanning is missing something in order to get it to work properly.
@team_hcs have you gotten barcode scanning to work yet?
@Vision Pro Engineer Thanks for responding. I did remove that code after posting this, and that did not make a difference. I also made sure my Vision Pro was updated to 2.0.1.
I'm using the standard template for an immersive space app and this is the code to launch my barcode immersive space. There's nothing missing in this part of the implementation is there?
import SwiftUI
@main
struct Enterprise3App: App {
@State private var appModel = AppModel()
@State private var avPlayerViewModel = AVPlayerViewModel()
var body: some Scene {
WindowGroup {
if avPlayerViewModel.isPlaying {
AVPlayerView(viewModel: avPlayerViewModel)
} else {
ContentView()
.environment(appModel)
}
}
ImmersiveSpace(id: appModel.immersiveSpaceID2) {
BarcodeView()
.environment(appModel)
.onAppear {
appModel.immersiveSpaceState = .open
}
.onDisappear {
appModel.immersiveSpaceState = .closed
}
}
.immersionStyle(selection: .constant(.mixed), in: .mixed)
}
}
struct BarcodeView: View {
@Environment(AppModel.self) var appModel
@State private var root = Entity()
@State private var arKitSession = ARKitSession()
var body: some View {
RealityView { content, attachments in
content.add(root)
if let barcodeAttachment = attachments.entity(for: "testView") {
barcodeAttachment.position = [0, 1, -1]
root.addChild(barcodeAttachment)
}
} placeholder: {
ProgressView()
} attachments: {
Attachment(id: "testView") {
Text("Looking for barcodes")
.bold()
.font(.largeTitle)
}
}
.task {
guard BarcodeDetectionProvider.isSupported else {
print("Barcode detection is not supported")
return
}
await arKitSession.requestAuthorization(for: [.cameraAccess, .worldSensing])
let barcodeDetection = BarcodeDetectionProvider(symbologies: [.code128, .code39, .code93, .ean8, .ean13, .qr, .upce])
do {
try await arKitSession.run([barcodeDetection])
for await update in barcodeDetection.anchorUpdates {
switch update.event {
case .added:
print("New barcode detected: \(update.anchor.payloadString ?? "")")
case .updated:
print("Barcode updated: \(update.anchor.payloadString ?? "")")
case .removed:
print("Barcode removed: \(update.anchor.payloadString ?? "")")
}
}
} catch {
print("Error running ARKit session: \(error.localizedDescription)")
}
}
}
}
@ickydime Definitely understand where that's supposed to be, and we have that third tab (Additional Capabilities) with a CarPlay entitlement in there, but no entitlement for any of the VisionOS features. Even though we've received the email with the license file.
@DTS Engineer I'm experiencing the same problem. I was granted the license file and it was emailed to me, but no entitlements added to the account. It seems a number of users are having the same problem with no recourse.
@Vision Pro Engineer I am in the exact same situation. I received the Enterprise license file last week, and am trying to add Barcode Detection to an app. I see the same issues that @houhua_yang sees, and I have verified that the Enterprise.license file is included in the Target Membership section.