Having the same issue.
I have the Enterprise API license added to my file and assigned to the build target.
I have the com.apple.developer.screen-capture.include-passthrough and com.apple.developer.arkit.main-camera-access-allow entitlements.
I have NSEnterpriseMCAMUsageDescription, NSCameraUsageDescription, and NSScreenCaptureUsageDescription entries in my plist.
I can create a CameraFrameProvider but as soon as I ask for CameraFrameUpdates I get this error, same as :
ar_camera_frame_provider_t <0x303b28fc0>: Failed to start camera stream with error: <ar_error_t: 0x3009a2de0 Error Domain=com.apple.arkit Code=100 "App not authorized." UserInfo={NSLocalizedFailureReason=Using camera frame provider requires an entitlement., NSLocalizedRecoverySuggestion=, NSLocalizedDescription=App not authorized.}>
Post
Replies
Boosts
Views
Activity
This earlier post happens to mention that ARKit only runs in an immersive space.
Apparently this means that the front camera can only be used in an immersive window? Can anyone from Apple confirm this?
I am running code in an immersive space and still getting the "app not authorized" error. Here is my code:
import RealityKit
import ARKit
struct ImmersiveView: View {
@State private var arkitSession = ARKitSession()
@State private var cameraAccessStatus: String = "Checking camera access..."
@State private var frameCount = 0
@State private var pixelBuffer: CVPixelBuffer?
var body: some View {
RealityView { realityView in
// Perform setup directly in RealityView
Task {
await setupARKitSession()
}
}
.edgesIgnoringSafeArea(.all)
.overlay(alignment: .top) {
VStack {
Text(cameraAccessStatus)
.font(.headline)
.foregroundColor(cameraAccessStatus == "Frames are displaying!" ? .green : .red)
Text("Frames processed: \(frameCount)")
.font(.subheadline)
}
.padding()
.background(Color.black.opacity(0.7))
.cornerRadius(10)
}
}
private func setupARKitSession() async {
let cameraFrameProvider = CameraFrameProvider()
do {
cameraAccessStatus = "Initializing ARKit session..."
print ("Initializing ARKit session...")
try await arkitSession.run([cameraFrameProvider])
let formats = CameraVideoFormat.supportedVideoFormats(for: .main, cameraPositions: [.left])
guard let highResolutionFormat = formats.max(by: { $0.frameSize.height < $1.frameSize.height }),
let cameraFrameUpdates = cameraFrameProvider.cameraFrameUpdates(for: highResolutionFormat) else {
print("Failed to start camera.")
cameraAccessStatus = "Failed to start camera."
return
}
print ("cameraFrameUpdates initialized successfully")
cameraAccessStatus = "Frames are coming!"
for await frame in cameraFrameUpdates {
if let sample = frame.sample(for: .left) {
DispatchQueue.main.async {
pixelBuffer = sample.pixelBuffer
frameCount += 1
print("Frame \(frameCount) received.")
}
}
}
} catch {
cameraAccessStatus = "Failed to start ARKit: \(error.localizedDescription)"
}
}
}
And here is the console output:
```Initializing ARKit session...
cannot add handler to 0 from 1 - dropping
cameraFrameUpdates initialized successfully
ar_camera_frame_provider_t <0x3011079f0>: Failed to start camera stream with error: <ar_error_t: 0x30238b060 Error Domain=com.apple.arkit Code=100 "App not authorized." UserInfo={NSLocalizedFailureReason=Using camera frame provider requires an entitlement., NSLocalizedRecoverySuggestion=, NSLocalizedDescription=App not authorized.}>
I checked entitlements with the codesign command and it looks like my app is correctly entitled:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>application-identifier</key><string>Z9FYRK8P89.com.imeve.avpenterprisetest</string><key>com.apple.developer.arkit.main-camera-access.allow</key><true/><key>com.apple.developer.screen-capture.include-passthrough</key><true/><key>com.apple.developer.team-identifier</key><string>Z9FYRK8P89</string><key>get-task-allow</key><true/></dict></plist>