Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Live Text

RSS for tag

Enable text interactions, translation, data detection, and QR code scanning within any image view on iOS, iPadOS, or macOS.

Posts under Live Text tag

13 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Translation API & Download Language Sheet
Using Apple SwiftUI Translate library: when calling: try await session.prepareTranslation() the first time, the API's Language Download sheet does not show (or shows briefly and dismisses immediately) Even when the sheet doesn't show, the keyboard is lowered, as though the sheet would be appearing, but then the keyboard raises as though the sheet was dismissed. The following Errors are printed in the console dozens of times; but on all subsequent executions, the API Language Download sheet shows as expected. The trigger code is in a function which is executed when a Translate button is tapped. Any ideas would be welcome! Console Error on first execution only LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} Attempt to map database failed: permission was denied. This attempt will not be retried. Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} Attempt to map database failed: permission was denied. This attempt will not be retried. Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} Attempt to map database failed: permission was denied. This attempt will not be retried. Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} Error returned from iconservicesagent image request: <ISBundleIdentifierIcon: 0x300df3c30> BundleID: (null) digest: 7749FEEE-F663-39B4-AD68-A18CFF762CCC - <ISImageDescriptor: 0x3033b26c0> - (64.00, 64.00)@2x v:4 l:5 a:0:0:0:0 t:() b:0 s:2 ps:0 digest: DF83A970-D4C9-3D90-BB7D-0BC21FC22E03 error: Error Domain=NSOSStatusErrorDomain Code=-609 "Client is disallowed from making such an icon request" UserInfo={NSLocalizedDescription=Client is disallowed from making such an icon request} Error returned from iconservicesagent image request: <ISTypeIcon: 0x300d0fb70>,Type: com.apple.appprotection.badge.faceid - <ISImageDescriptor: 0x3033ad0e0> - (32.00, 32.00)@2x v:0 l:5 a:0:0:0:0 t:() b:0 s:2 ps:0 digest: 648D7A72-90CB-3858-9409-5C554BB43B8E error: Error Domain=NSOSStatusErrorDomain Code=-609 "Client is disallowed from making such an icon request" UserInfo={NSLocalizedDescription=Client is disallowed from making such an icon request} Connection interrupted, finishing translation with error Error Domain=TranslationErrorDomain Code=14 "(null)" Got response from extension with error: Error Domain=TranslationErrorDomain Code=14 "(null)" Reported that remote UI finished but didn't get finished configuration, reporting the error as: Error Domain=TranslationErrorDomain Code=20 "(null)" VS terminated with error: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method} Reported that remote UI finished but didn't get finished configuration, reporting the error as: Error Domain=TranslationErrorDomain Code=14 "(null)" VS terminated with error: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method} VS terminated with error: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method} VS terminated with error: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method} VS terminated with error: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method} Trigger the Translation: // check if we need to create a translation configuration if configuration == nil { configuration = TranslationSession.Configuration.init( source: Locale.Language(identifier: sourceLanguageCode), target: Locale.Language(identifier: targetLanguageCode) ) } else { // or just update the target code then invalidate the config to re-trigger the refresh of .translationTask() configuration?.source = Locale.Language(identifier: sourceLanguageCode) configuration?.target = Locale.Language(identifier: targetLanguageCode) configuration?.invalidate() } Prepare and check if Download sheet should be presented: .translationTask(configuration) { session in do { // prepare translation & present API download sheet if lanugage download needed. try await session.prepareTranslation() } catch { print("Translate failed: \(error)") } }
4
0
67
May ’25
DataScannerViewController does't recognize currency less 1.00
Hi, DataScannerViewController does't recognize currencies less than 1.00 (e.g. 0.59 USD, 0.99 EUR, etc.). Why? How to solve the problem? This feature is not described in Apple documentation, is there a solution? This is my code: func makeUIViewController(context: Context) -&gt; DataScannerViewController { let dataScanner = DataScannerViewController(recognizedDataTypes: [ .text(textContentType: .currency)]) return dataScanner }
4
0
90
Apr ’25
Trouble Translating a Second Word Using TranslationAPI
I’m developing an app to save words that users learn in a language they are studying. Here’s the basic workflow: Type a new word Add the new word Every time a word is added, it gets saved to a list that includes its meaning and the name of the language — useful when saving words in multiple languages Problem: For some reason, the “Add new word” button only works for the first word. The second word is not being added to the list. Here is my code: import SwiftUI import NaturalLanguage import Translation struct ContentView: View { @State private var inputWord: String = "" @State private var detectedLanguage: String? @State private var translationConfiguration: TranslationSession.Configuration? @StateObject private var viewModel = WordViewModel() var body: some View { VStack(spacing: 24) { // Input field TextField("Type a word in any language", text: $inputWord) .padding() .background(Color(.systemGray6)) .cornerRadius(10) // Button to translate and save Button("Add new word") { translateAndSave() } // .disabled(inputWord.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty) .buttonStyle(.borderedProminent) // List of saved words Text("My Words") .font(.system(.title2)) List { ForEach(viewModel.words) { word in VStack(alignment: .leading, spacing: 4) { Text(word.inputWord) .font(.headline) Text(word.nativeTranslation) .font(.subheadline) .foregroundColor(.gray) Text(word.detectedLanguage.uppercased()) .font(.caption) .foregroundColor(.blue) } .padding(.vertical, 4) } } Spacer() } .padding() .animation(.easeInOut, value: detectedLanguage) // Automatically triggers translation when configuration changes .translationTask(translationConfiguration) { session in do { let response = try await session.translate(inputWord) viewModel.addWord( input: inputWord, native: response.targetText, detected: detectedLanguage ?? "Unknown" ) // Reset fields after saving inputWord = "" detectedLanguage = nil translationConfiguration = nil } catch { // Handle error print("Translation error: \(error.localizedDescription)") } } } // Function to detect language private func detectLanguage() { let recognizer = NLLanguageRecognizer() recognizer.processString(inputWord) if let code = recognizer.dominantLanguage?.rawValue { let name = Locale.current.localizedString(forIdentifier: code) detectedLanguage = name?.capitalized } else { detectedLanguage = "Unable to detect" } } // Function to prepare translation private func translateAndSave() { detectLanguage() translationConfiguration = TranslationSession.Configuration( source: nil, target: Locale.Language(identifier: "en") ) } } Question: Does anyone have any idea what I can do to fix this?
2
0
41
Apr ’25
Translation framework error.
Hello everyone. I use Translation Framework in my application. During development everything was fine, Translation framework worked well, but after two or three days of using the production version (that was published in AppStore and available for others also!) - my application stopped working. Translation framework gives errors: Error sending 1 paragraphs Error Domain=TranslationErrorDomain Code=16 "Translation failed" UserInfo={NSLocalizedDescription=Translation failed, NSLocalizedFailureReason=Offline models not available for language pair} Failed to translate input 0; returning error: Error Domain=TranslationErrorDomain Code=16 "Translation failed" UserInfo={NSLocalizedDescription=Translation failed, NSLocalizedFailureReason=Offline models not available for language pair} Received unbridged NSError to API, converting to .internalError: Error Domain=TranslationErrorDomain Code=16 "Translation failed" UserInfo={NSLocalizedDescription=Translation failed, NSLocalizedFailureReason=Offline models not available for language pair} Once again - it worked when I developed it, it was released on the AppStore, and suddenly it stopped working!
4
2
141
Mar ’25
Do the coordinates obtained by scanning a QR code with VNDetectBarcodesRequest match the coordinates of the finder pattern?
I am creating an application that uses VNDetectBarcodesRequest to read QR codes from images and adjust the image orientation to match that of the QR code finder pattern. The QR code was successfully read, and the coordinates of the QR code were obtained.Upon checking the obtained topLeft, topRight, and bottomLeft coordinates, they always seem to match the topLeft, topRight, and bottomLeft coordinates of the finder pattern. Is it specified that the coordinates of topLeft, topRight, and bottomLeft obtained with VNDetectBarcodesRequest match the topLeft, topRight, and bottomLeft of the finder pattern? Or do they just happen to match? I would appreciate it if you could tell me if the matching of coordinates is a specification. Thank you for your help.
0
0
283
Feb ’25
App Clip Invocation Issues on iOS 18 and iOS 18.1 - NFC and QR Invocation not working for Default App Clip Experience
We have identified an issue on iOS 18 and iOS 18.1 (developer beta) where App Clips invoked via NFC or QR codes without a pre-configured Advanced App Clip experience (aka they should be using the Default App Clip Experience) are not functioning as expected. This issue is specific to iOS 18, as the behavior works correctly on iOS devices running 17.x. Steps to Reproduce: Set up two scenarios: One scenario where an App Clip has a pre-configured advanced app clip experience (with metadata such as title, subtitle, image). Another scenario where the App Clip is invoked without any pre-configured experience (should use the default App Clip experience). On an iOS 18 or iOS 18.1 device: For the default App Clip experience (no pre-configured advanced app clip experence): Scan the NFC tag when the phone is locked. Scan the NFC tag when the phone is unlocked. Scan the QR code. For the pre-configured App Clip experience: Perform the same tests (NFC and QR code scans). Test the same scenarios on an iOS 17 device for comparison. Expected Behavior: For default App Clip experience invocations (NFC or QR): Scanning NFC or QR should still trigger the App Clip card, even without metadata or a pre-configured advanced experience, on both locked and unlocked devices. For pre-configured Advanced App Clip Experence invocations: The App Clip card should display correctly with the configured metadata and behave as expected on both locked and unlocked devices. Observed Behavior on iOS 18 and iOS 18.1: For default App Clip experience invocations: When scanning the NFC tag on a locked device, an error message is shown - e.g., "App Clip Unavailable" or "The operation couldn't be completed. (CPSErrorDomain error 2.)" . When scanning the NFC tag on an unlocked device, the system redirects straight to the web browser instead of displaying the App Clip card (or even the normal NFC top of screen push notification style thing) Scanning the QR code also prompts the user to open the web browser similar to the experience of scanning a non app clip QR code, skipping the expected App Clip experience. For pre-configured Advanced App Clip Experence invocations: The App Clip behaves as expected, showing the correct card with metadata and functioning properly on both locked and unlocked devices. Notes: The issue is only observed on iOS 18 and iOS 18.1, while the expected behavior is working fine on iOS 17. This may indicate a regression or change in behavior introduced with iOS 18 that affects App Clip invocations that do not have a pre-configured experience.
4
7
1.4k
Oct ’24
Issue: ARKit Camera Frame Provider Not Authorized in visionOS App
I’m developing a visionOS app using EnterpriseKit, and I need access to the main camera for QR code detection. I’m using the ARKit CameraFrameProvider and ARKitSession to capture frames, but I’m encountering this error when trying to start the camera stream: ar_camera_frame_provider_t: Failed to start camera stream with error: <ar_error_t Error Domain=com.apple.arkit Code=100 "App not authorized."> Context: VisionOS using EnterpriseKit for camera access and QR code scanning. My Info.plist includes necessary permissions like NSCameraUsageDescription and NSWorldSensingUsageDescription. I’ve added the com.apple.developer.arkit.main-camera-access.allow entitlement as per the official documentation here. My app is allowed camera access as shown in the logs (Authorization status: [cameraAccess: allowed]), but the camera stream still fails to start with the “App not authorized” error. I followed Apple’s WWDC 2024 sample code for accessing the main camera in visionOS from this session. Sample of My Code: import ARKit import Vision class QRCodeScanner: ObservableObject { private var arKitSession = ARKitSession() private var cameraFrameProvider = CameraFrameProvider() private var pixelBuffer: CVPixelBuffer? init() { Task { await requestCameraAccess() } } private func requestCameraAccess() async { await arKitSession.queryAuthorization(for: [.cameraAccess]) do { try await arKitSession.run([cameraFrameProvider]) } catch { print("Failed to start ARKit session: \(error)") return } let formats = CameraVideoFormat.supportedVideoFormats(for: .main, cameraPositions: [.left]) guard let cameraFrameUpdates = cameraFrameProvider.cameraFrameUpdates(for: formats[0]) else { return } Task { for await cameraFrame in cameraFrameUpdates { guard let mainCameraSample = cameraFrame.sample(for: .left) else { continue } self.pixelBuffer = mainCameraSample.pixelBuffer // QR Code detection code here } } } } Things I’ve Tried: Verified entitlements in both Info.plist and .entitlements files. I have added the com.apple.developer.arkit.main-camera-access.allow entitlement. Confirmed camera permissions in the privacy settings. Followed the official documentation and WWDC 2024 sample code. Checked my provisioning profile to ensure it supports ARKit camera access. Request: Has anyone encountered this “App not authorized” error when accessing the main camera via ARKit in visionOS using EnterpriseKit? Are there additional entitlements or provisioning profile configurations I might be missing? Any help would be greatly appreciated! I haven't seen any official examples using new API for main camera access and no open source examples either.
9
1
1k
Oct ’24
iOS 18.1 beta - App crashes at runtime while using Translation.TranslationError in project
I'm trying to cast the error thrown by TranslationSession.translations(from:) as Translation.TranslationError. However, the app crashes at runtime whenever Translation.TranslationError is used in the project. Environment: iOS Version: 18.1 beta Xcode Version: 16 beta yld[14615]: Symbol not found: _$s11Translation0A5ErrorVMa Referenced from: <3426152D-A738-30C1-8F06-47D2C6A1B75B> /private/var/containers/Bundle/Application/043A25BC-E53E-4B28-B71A-C21F77C0D76D/TranslationAPI.app/TranslationAPI.debug.dylib Expected in: /System/Library/Frameworks/Translation.framework/Translation
1
1
1.2k
Aug ’24
Specific barcode is not recognized
Hi, I face a problem that I could not scan a specific Code 39 barcode with Vision framework. We have multiple barcode in a label and almost all Code 39 can be scanned, but not for specific one. One more information, regardless the one that is not recognized with Vision can be read by a general barcode scanner. Have anyone faced similar situation? Is there unique condition to make it hard to scan the barcode when using Vision?(size, intensity, etc) Regards,
1
0
816
Oct ’24