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

48 Posts

Post

Replies

Boosts

Views

Activity

Delegate methods of ImageAnalysisInteractionDelegate don't fire
I have a live text implementation on the following LiveTextImageView. However, after the view loads and the analyze code is run, none of the delegate methods fire when I interact with the Live View. Selecting text does not fire the textSelectionDidChange method, nor does highlightSelectedItemsDidChange fire when the live text button in the bottom right is pressed. I tried a few different implementations, including an approach where the delegate was defined on a separate class. I am running this on a iPhone 12 Pro I recently updated to 17.0.3. My goal is to be able to provide additional options to the user beyond the default live-text overlay options, after identifying when they have finished selecting text. // // LiveTextImageView.swift // import UIKit import SwiftUI import VisionKit class ImageAnalyzerWrapper { static let shared = ImageAnalyzer() private init() { } } struct LiveTextImageViewRepresentable: UIViewRepresentable { var image: UIImage func makeUIView(context: Context) -> LiveTextImageView { return LiveTextImageView(image: image) } func updateUIView(_ uiView: LiveTextImageView, context: Context) { } } class LiveTextImageView: UIImageView, ImageAnalysisInteractionDelegate, UIGestureRecognizerDelegate { var capturedSelectedText: String? let analyzer = ImageAnalyzerWrapper.shared let interaction = ImageAnalysisInteraction() init(image: UIImage) { super.init(frame: .zero) self.image = image let photoWrapper = PhotoWrapper(rawPhoto: image) let resizedPhoto = photoWrapper.viewportWidthCroppedPhoto(padding: 40) self.image = resizedPhoto self.contentMode = .scaleAspectFit self.addInteraction(interaction) interaction.preferredInteractionTypes = [] interaction.analysis = nil analyzeImage() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func analyzeImage() { if let image = self.image { Task { let configuration = ImageAnalyzer.Configuration([.text]) do { let analysis = try await analyzer.analyze(image, configuration: configuration) self.addInteraction(interaction) interaction.delegate = self interaction.analysis = analysis interaction.preferredInteractionTypes = .textSelection } catch { print("Error in live image handling") } } } } func interaction( _ interaction: ImageAnalysisInteraction, highlightSelectedItemsDidChange highlightSelectedItems: Bool) async { print("Highlighted items changed") } func interaction(_ interaction: ImageAnalysisInteraction, shouldBeginAt point: CGPoint, for interactionType: ImageAnalysisInteraction.InteractionTypes) async -> Bool { return interaction.hasInteractiveItem(at: point) || interaction.hasActiveTextSelection } func textSelectionDidChange(_ interaction: ImageAnalysisInteraction) async { print("Changed!") if #available(iOS 17.0, *) { capturedSelectedText = interaction.text print(capturedSelectedText ?? "") } } }
0
0
934
Oct ’23
QR Code Scanning: Safari loading previously scanned URL while using iPhone camera app
We are using URL encoded in QR code to open our web application. When user scans QR using the default Camera app on iPhone, upon clicking the link iOS opens the webpage on safari browser. Our URL looks like this "https://abc.com?qrdata=1", "https://abc.com?qrdata=2", "https://abc.com?qrdata=3". The URL query parameter(qrdata) differs for different process in the web app. So when so each QR code has same domain but different query parameters. If the user scans QR for https://abc.com?qrdata=1, the web page is opened on safari without any issue. If user scansQR for https://abc.com?qrdata=2 after the first QR code then for some reason on first attempt Safari is loading the previously scanned URL, in this case https://abc.com?qrdata=1. The change in query params is not received correctly by Safari. If we scan the new QR code twice then works on 2nd attempt to scan the QR. I can see from the history that the URL scanned is not the right url This is issue only on Safari iOS devices, on anyother browser works as expected.
0
0
1.9k
Sep ’23
Got compile error while trying to process a rectangle type of detection instead of QR
I was switching the Detector scanner from QR to Rectangle type of detection but on Rectangle type of detection I cannot take the feature.messageString out of CIRectangleFeature, while on CIQRCodeFeature it works. Only what I had changed was ofType: CIDetectorTypeQRCode into CIDetectorTypeRectangle and features as? [CIQRCodeFeature] into features as? [CIRectangleFeature] here is the code func processQRCodeImage(_ image: UIImage) { var qrCodeLink = "" let detector: CIDetector = CIDetector(ofType: CIDetectorTypeRectangle, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh])! let ciImage: CIImage = CIImage(image: image)! let features = detector.features(in: ciImage) if let features = features as? [CIRectangleFeature] { for feature in features { qrCodeLink += feature.messageString! // Value of type 'CIRectangleFeature' has no member 'messageString' COMPILE ERROR } } if qrCodeLink.isEmpty { failedQRCoderead() } else { found(code: qrCodeLink) onBackPressed?() } }
0
0
622
Jul ’23
After updating iphone to ios 17 my sent text messages wont appear on ipad an imac
After loading iOS 17 on my iPhone 13 pro max it won't send the messages I type on my phone to iPad or Mac computers. I have restarted all iMessage settings several times checked message forwarding setting all are in order. I also checked the Apple ID it is the same on all devices. Any suggestions would be appreciated to fix the problem thanks.
0
0
831
Jun ’23
Multiple ImageAnalysisInteractions
Hello there! Really excited about this year's additions to ImageAnalysisInteraction, especially the selectedText. Thank you! My question is if there's a way to have multiple interactions for a given image analysis. For example, instead of being able to make just one text selection, I would like to support multiple. In theory, I know multiple UIInteraction-conforming objects can be added to any view but I'm unsure if this is possible with ImageAnalysisInteraction. I'm willing to create a custom UIInteraction, if you see a potential way forward there (would love to hear any ideas!). Side question/feature request: UITextSelectionDisplayInteraction, which I assume ImageAnalysisInteraction might be using internally, allows handleViews customizations and others. I would be super useful if that was exposed through ImageAnalysisInteraction as well! Looking forward to hearing your ideas. TIA!
0
0
1.2k
Jun ’23
Problems using Live Text
I am developing a simple app which downloads image from a url and then applying live text interactions to that image. Here's that piece of code import SwiftUI import VisionKit struct LiveTextInteractionView: View { var post: Post @Environment (\.presentationMode) var presentationMode var body: some View { NavigationView { if let postImageURL = post.imageURL { LiveTextInteraction(imageName: postImageURL) .toolbar { ToolbarItem(placement: .navigationBarLeading) { Button { self.presentationMode.wrappedValue.dismiss() } label: { Text("Cancel") } } } .interactiveDismissDisabled(true) } else { Text("NO Image") } } } } @MainActor struct LiveTextInteraction: UIViewRepresentable { var imageName: URL let imageView = LiveTextImageView() let interaction = ImageAnalysisInteraction() let analyzer = ImageAnalyzer() func makeUIView(context: Context) -> some UIView { imageView.imageFrom(url: imageName) /*👆 Downloading from an URL doesn't work ❌*/ imageView.image=UIImage(named: "one.png") /*👆Loading from assets folder works ✅*/ imageView.addInteraction(interaction) imageView.contentMode = .scaleAspectFit return imageView } func updateUIView(_ uiView: UIViewType, context: Context) { Task { let configuration = ImageAnalyzer.Configuration([.text,.machineReadableCode]) do { if let image = imageView.image { let analysis = try await analyzer.analyze(image, configuration: configuration) interaction.analysis = analysis; interaction.preferredInteractionTypes = .automatic } } catch { print("error:\(error)") } } } } class LiveTextImageView: UIImageView { /* Use intrinsicContentSize to change the default image size so that we can change the size in our SwiftUI View */ override var intrinsicContentSize: CGSize { .zero } } extension UIImageView { func imageFrom(url:URL){ DispatchQueue.global().async { [weak self] in if let data = try? Data(contentsOf: url){ if let image = UIImage(data:data){ DispatchQueue.main.async{ self?.image = image } } } } } } The problem is the image is getting downloaded and displayed but the live text controls are not appearing. But when I put an image in the assets folder and tried to load it and the live text controls appear. When loading image from assets folder👇 When downloading the image from URL👇
0
0
857
Apr ’23
QR Code for local network pdf
I am looking for a way to create a static QR code that can open a pdf in a shared folder on an iPhone that is connected to the local LAN via Wi-Fi. I will create a “Shared folder” on my network but I would like the folder only accessible from my LAN not a hosted solution. I am more familiar with windows. On windows I can use the command: start "\Server\Shared Folder\file.pdf" and it would open the pdf. Is this something possible. I have seen the QR code to add a SSID and Password for Wi-Fi so I know some scripting can be achieved with a QR code. Any help is greatly appreciated.
0
0
683
Mar ’23
[Appclip Bug]: QR hold-menu Appclip launch does not open Appclip
Steps to repro: Create a QR code of a valid Appclip URL embed code on a webpage In safari, tap and hold on the QR image then select 'View APP_CLIP_NAME' AppClip doesn't launch Expected result: Same outcome as tapping the 'View/Open' button on an appclip banner. This issue occurs on all domains and urls, including those registered to the appclip in question.
1
0
958
Mar ’23
ImageAnalyzer running VNRecognizeTextRequest in the background?
Using VisionKit, there's two main ways to get text from images. ImageAnalyzer VNRecognizeRequest Based on some OCR tests, I'm seeing that the outputs from these two methods are different. Initially, I thought ImageAnalyzer was running VNRequestTextRecognitionLevel.fast because it's for Live Text, but the outputs from ImageAnalyzer are sometimes better than VNRequestTextRecognitionLevel.accurate. Is ImageAnalyzer running VNRequestTextRecognition in the background? Or if it isn't, what pipeline is it using to detect text?
0
2
901
Dec ’22
QR codes in app
Hi, I am building an app that has a physical good attached to it but you do not pay for the physical good on the app or there is not link what so ever to buy this physical good on the app. I want to verify the physical good so I know it is not a fake on the app through a QR code feature. Do apple allow this function on an app? And if so do they charge commission on doing this, as this is not an in-app purchase, it is simply a verification method?
0
1
1.5k
Nov ’22
Automate live text copy from Mac preview in image
I have bunch of images in a folder where I'm trying to copy live text from each image and paste it in text file I am trying to use AppleScript to open image in Preview->Text selection-> Command + a but its not selecting live text its just selecting image. I am open to using any swift script to suggest me how to process my images to get live text. Thanks. Apple script tell application "Finder" set fl to files of folder POSIX file "/Users/Data" as alias list end tell repeat with f in fl tell application "Preview" activate open f tell application "System Events" tell its process "Preview" click menu item "Text Selection" of menu "Tools" of menu bar 1 end tell end tell delay 5 tell application "System Events" tell application process "Preview" click at {100, 200} delay 2 keystroke "a" using command down delay 1 end tell end tell delay 30 repeat until (count of windows) > 0 delay 2.0 end repeat close front document end tell end repeat
0
0
1.5k
Nov ’22
Safari on MacOS overlays block-areas on included images (inserts HTML in real time) - blocking access to my own linked areas!
I include a picture on an HTML page by: <img src="./name.png" class="inline" alt="" usemap="#html"/> I create a link map, defining areas of the picture that I want to link to notes like this: <map name="html"> <area shape="circle" coords="73,250,30" href="./PassiveStrideRecovery_W12_Notes.html" alt="PassiveStrideRecovery_W12" target="_self" /> ...(more of these areas) </map> All the linked areas work fine for a few seconds and then some of the areas are obscured by automatically detected (not well though) areas of interest (to something) in the .png and stops my mouse clicks getting through to some of the linked areas I define. When I use the Debug menu item and examine the HTML source elements (using "Develop->Show Page Source") I created. Initially they include: a minute to so later they change to: indicating the img has acquired some extra structure, which now looks like this: and define some areas, some of which overlay my map areas in a layer above mine. Looking at the last "div" created by MacOS, they seem to be inserted in real-time by Apple Data Detectors. I changed my img include statement to <img src="./GroundContact_W7_Bubbles.png" x-apple-data-detectors="false" class="inline" alt="" usemap="#html"/> but it made no difference. How do I stop real-time area overlay of click-obscuring blocks over pictures included on my HTML page? TIA
2
1
2.8k
Nov ’22
captureTextFromCamera action is not get triggered in iPad Air (4th gen)
Hi folks, I tried to use apple's text recognition feature by using UIAction.captureTextFromCamera(responder:identifier:). It works fine in iPhone and iPad 3rd Gen. But in iPad 4th Gen the action is not get triggered. Kindly provide assistance . if #available(iOS 15.0, *), self.canPerformAction(#selector(captureTextFromCamera(_:)), withSender: self) {       let cameraAction = UIAction.captureTextFromCamera(responder: self, identifier: nil)       let cameraButton = UIButton(type: .custom)       cameraButton.addAction(cameraAction, for: .touchUpInside)       cameraButton.setTitle("Scan-Text", for: .normal)       view.addSubview(cameraButton)       // Then set constraints     } _Note: The button to trigger the action is visible only the action is not get triggered. _ Device specs: Name: iPad Air 4th Gen Os : iOS 16
0
0
1.1k
Oct ’22
In Live Text API, text selection or clicking the highlight button on the right does not work
I am implementing Live Text function using ImageAnalysisInteraction and ImageAnalyzer. After loading an image file into UIImageView , I am trying to implement a function to select like a TextView using Live Text function. On the right side of the UIImageView, a button to change the Live Text highlight state is displayed. However, there is a phenomenon that this button cannot be clicked. Also, even if you change the highlight state to Live Text, it is not selected like UITextView. imageView.addInteraction(interaction) I added an interaction to the imageview like this. Even if I keep changing preferredInteractionTypes to multiple types, there is no choice. interaction.view!.isUserInteractionEnabled = true imageView.isUserInteractionEnabled = true So I also changed the isUserInteractionEnabled value to true . Have any of you solved this problem?
0
0
1k
Oct ’22
Error when using Live Text API
I am developing a function using Live Text. (I used ImageAnalyzer and ImageAnalysisInteraction.) When executed, the following error log is displayed and the Live Text Button is displayed but not clicked or highlighted. That is, it does nothing. [Unknown process name] Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem. [Unknown process name] If you want to see the backtrace, please set CG_NUMERICS_SHOW_BACKTRACE environmental variable. [api] -[CIImage initWithCVPixelBuffer:options:] failed because the buffer is nil. Are there any possible causes and solutions for this not working? Or is there a setting I'm missing in order to use LiveText? Below is part of the code. Changing preferredInteractionTypes to all types doesn't change anything. UIImageViews are displayed by switching left and right through UIPageViewController and calling the LiveText function. Task { var analyzer:ImageAnalyzer? = ImageAnalyzer()             if analyzer == nil {                 return             }             let configuration = ImageAnalyzer.Configuration([.text])             do {                 let pAnalysis = try await analyzer!.analyze(image!, configuration: configuration)                 DispatchQueue.main.async {                                          //interaction!.preferredInteractionTypes = .automatic                     interaction.preferredInteractionTypes = .textSelection                     //interaction!.preferredInteractionTypes = .dataDetectors                     //interaction!.preferredInteractionTypes = [.textSelection, .dataDetectors]                     //interaction.preferredInteractionTypes = [.textSelection, .dataDetectors, .automatic]                     interaction.selectableItemsHighlighted = true                     interaction.analysis = pAnalysis                     interaction.setContentsRectNeedsUpdate()                 }             } catch {}             analyzer = nil }
0
1
1.4k
Sep ’22
Code to Send SMS to several Phone numbers
Hello Here is my problem. If i scan a QR code which aim is to send SMS to several numbers, IOS will only send a SMS to the first phone number. Code is : SMSTO:NUMBER1:NUMBER2:SMSCONTENT This code will work with any Android device but not with Iphones. I've been calling Apple but they told they don't know how to separate phone numbers in such a Code to do the job. I tried with ";" (works with Android too), space, /, blank, ",+... None of them work. If somebody could help thanks a lot
1
0
1.4k
Sep ’22
Crash
Hello! I found a crash at the start of the app with an error: error: memory read failed for 0x0 Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) If I add to the project: @available(iOS 16.0, *) @MainActor class SomeClass { var configuration: ImageAnalyzer.Configuration? } But if I replace the class with a structure, then the app will run without crash: @available(iOS 16.0, *) @MainActor struct SomeStruct {     var configuration: ImageAnalyzer.Configuration? } Xcode 14.0 beta 5 (14A5294e) iOS 15.6 On iOS 16 beta, both options work, without crashes. Any suggestion as to what to look for?
2
1
1.9k
Aug ’22
Italian live captions
Hi everyone, do you know when real-time subtitles for Italian language calls will be implemented in iPhone?
Replies
0
Boosts
0
Views
717
Activity
Jan ’24
Delegate methods of ImageAnalysisInteractionDelegate don't fire
I have a live text implementation on the following LiveTextImageView. However, after the view loads and the analyze code is run, none of the delegate methods fire when I interact with the Live View. Selecting text does not fire the textSelectionDidChange method, nor does highlightSelectedItemsDidChange fire when the live text button in the bottom right is pressed. I tried a few different implementations, including an approach where the delegate was defined on a separate class. I am running this on a iPhone 12 Pro I recently updated to 17.0.3. My goal is to be able to provide additional options to the user beyond the default live-text overlay options, after identifying when they have finished selecting text. // // LiveTextImageView.swift // import UIKit import SwiftUI import VisionKit class ImageAnalyzerWrapper { static let shared = ImageAnalyzer() private init() { } } struct LiveTextImageViewRepresentable: UIViewRepresentable { var image: UIImage func makeUIView(context: Context) -> LiveTextImageView { return LiveTextImageView(image: image) } func updateUIView(_ uiView: LiveTextImageView, context: Context) { } } class LiveTextImageView: UIImageView, ImageAnalysisInteractionDelegate, UIGestureRecognizerDelegate { var capturedSelectedText: String? let analyzer = ImageAnalyzerWrapper.shared let interaction = ImageAnalysisInteraction() init(image: UIImage) { super.init(frame: .zero) self.image = image let photoWrapper = PhotoWrapper(rawPhoto: image) let resizedPhoto = photoWrapper.viewportWidthCroppedPhoto(padding: 40) self.image = resizedPhoto self.contentMode = .scaleAspectFit self.addInteraction(interaction) interaction.preferredInteractionTypes = [] interaction.analysis = nil analyzeImage() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func analyzeImage() { if let image = self.image { Task { let configuration = ImageAnalyzer.Configuration([.text]) do { let analysis = try await analyzer.analyze(image, configuration: configuration) self.addInteraction(interaction) interaction.delegate = self interaction.analysis = analysis interaction.preferredInteractionTypes = .textSelection } catch { print("Error in live image handling") } } } } func interaction( _ interaction: ImageAnalysisInteraction, highlightSelectedItemsDidChange highlightSelectedItems: Bool) async { print("Highlighted items changed") } func interaction(_ interaction: ImageAnalysisInteraction, shouldBeginAt point: CGPoint, for interactionType: ImageAnalysisInteraction.InteractionTypes) async -> Bool { return interaction.hasInteractiveItem(at: point) || interaction.hasActiveTextSelection } func textSelectionDidChange(_ interaction: ImageAnalysisInteraction) async { print("Changed!") if #available(iOS 17.0, *) { capturedSelectedText = interaction.text print(capturedSelectedText ?? "") } } }
Replies
0
Boosts
0
Views
934
Activity
Oct ’23
QR Code Scanning: Safari loading previously scanned URL while using iPhone camera app
We are using URL encoded in QR code to open our web application. When user scans QR using the default Camera app on iPhone, upon clicking the link iOS opens the webpage on safari browser. Our URL looks like this "https://abc.com?qrdata=1", "https://abc.com?qrdata=2", "https://abc.com?qrdata=3". The URL query parameter(qrdata) differs for different process in the web app. So when so each QR code has same domain but different query parameters. If the user scans QR for https://abc.com?qrdata=1, the web page is opened on safari without any issue. If user scansQR for https://abc.com?qrdata=2 after the first QR code then for some reason on first attempt Safari is loading the previously scanned URL, in this case https://abc.com?qrdata=1. The change in query params is not received correctly by Safari. If we scan the new QR code twice then works on 2nd attempt to scan the QR. I can see from the history that the URL scanned is not the right url This is issue only on Safari iOS devices, on anyother browser works as expected.
Replies
0
Boosts
0
Views
1.9k
Activity
Sep ’23
iOS autorepeat code for character buttons and editing buttons.
Autorepeat key works in Notes for iPads, iPhone , but need code in Xcode for an iOS application using buttons as text input and text editing. Could not find any code. Thanks for replying Charlie
Replies
0
Boosts
0
Views
739
Activity
Aug ’23
Got compile error while trying to process a rectangle type of detection instead of QR
I was switching the Detector scanner from QR to Rectangle type of detection but on Rectangle type of detection I cannot take the feature.messageString out of CIRectangleFeature, while on CIQRCodeFeature it works. Only what I had changed was ofType: CIDetectorTypeQRCode into CIDetectorTypeRectangle and features as? [CIQRCodeFeature] into features as? [CIRectangleFeature] here is the code func processQRCodeImage(_ image: UIImage) { var qrCodeLink = "" let detector: CIDetector = CIDetector(ofType: CIDetectorTypeRectangle, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh])! let ciImage: CIImage = CIImage(image: image)! let features = detector.features(in: ciImage) if let features = features as? [CIRectangleFeature] { for feature in features { qrCodeLink += feature.messageString! // Value of type 'CIRectangleFeature' has no member 'messageString' COMPILE ERROR } } if qrCodeLink.isEmpty { failedQRCoderead() } else { found(code: qrCodeLink) onBackPressed?() } }
Replies
0
Boosts
0
Views
622
Activity
Jul ’23
After updating iphone to ios 17 my sent text messages wont appear on ipad an imac
After loading iOS 17 on my iPhone 13 pro max it won't send the messages I type on my phone to iPad or Mac computers. I have restarted all iMessage settings several times checked message forwarding setting all are in order. I also checked the Apple ID it is the same on all devices. Any suggestions would be appreciated to fix the problem thanks.
Replies
0
Boosts
0
Views
831
Activity
Jun ’23
Multiple ImageAnalysisInteractions
Hello there! Really excited about this year's additions to ImageAnalysisInteraction, especially the selectedText. Thank you! My question is if there's a way to have multiple interactions for a given image analysis. For example, instead of being able to make just one text selection, I would like to support multiple. In theory, I know multiple UIInteraction-conforming objects can be added to any view but I'm unsure if this is possible with ImageAnalysisInteraction. I'm willing to create a custom UIInteraction, if you see a potential way forward there (would love to hear any ideas!). Side question/feature request: UITextSelectionDisplayInteraction, which I assume ImageAnalysisInteraction might be using internally, allows handleViews customizations and others. I would be super useful if that was exposed through ImageAnalysisInteraction as well! Looking forward to hearing your ideas. TIA!
Replies
0
Boosts
0
Views
1.2k
Activity
Jun ’23
Problems using Live Text
I am developing a simple app which downloads image from a url and then applying live text interactions to that image. Here's that piece of code import SwiftUI import VisionKit struct LiveTextInteractionView: View { var post: Post @Environment (\.presentationMode) var presentationMode var body: some View { NavigationView { if let postImageURL = post.imageURL { LiveTextInteraction(imageName: postImageURL) .toolbar { ToolbarItem(placement: .navigationBarLeading) { Button { self.presentationMode.wrappedValue.dismiss() } label: { Text("Cancel") } } } .interactiveDismissDisabled(true) } else { Text("NO Image") } } } } @MainActor struct LiveTextInteraction: UIViewRepresentable { var imageName: URL let imageView = LiveTextImageView() let interaction = ImageAnalysisInteraction() let analyzer = ImageAnalyzer() func makeUIView(context: Context) -> some UIView { imageView.imageFrom(url: imageName) /*👆 Downloading from an URL doesn't work ❌*/ imageView.image=UIImage(named: "one.png") /*👆Loading from assets folder works ✅*/ imageView.addInteraction(interaction) imageView.contentMode = .scaleAspectFit return imageView } func updateUIView(_ uiView: UIViewType, context: Context) { Task { let configuration = ImageAnalyzer.Configuration([.text,.machineReadableCode]) do { if let image = imageView.image { let analysis = try await analyzer.analyze(image, configuration: configuration) interaction.analysis = analysis; interaction.preferredInteractionTypes = .automatic } } catch { print("error:\(error)") } } } } class LiveTextImageView: UIImageView { /* Use intrinsicContentSize to change the default image size so that we can change the size in our SwiftUI View */ override var intrinsicContentSize: CGSize { .zero } } extension UIImageView { func imageFrom(url:URL){ DispatchQueue.global().async { [weak self] in if let data = try? Data(contentsOf: url){ if let image = UIImage(data:data){ DispatchQueue.main.async{ self?.image = image } } } } } } The problem is the image is getting downloaded and displayed but the live text controls are not appearing. But when I put an image in the assets folder and tried to load it and the live text controls appear. When loading image from assets folder👇 When downloading the image from URL👇
Replies
0
Boosts
0
Views
857
Activity
Apr ’23
QR Code for local network pdf
I am looking for a way to create a static QR code that can open a pdf in a shared folder on an iPhone that is connected to the local LAN via Wi-Fi. I will create a “Shared folder” on my network but I would like the folder only accessible from my LAN not a hosted solution. I am more familiar with windows. On windows I can use the command: start "\Server\Shared Folder\file.pdf" and it would open the pdf. Is this something possible. I have seen the QR code to add a SSID and Password for Wi-Fi so I know some scripting can be achieved with a QR code. Any help is greatly appreciated.
Replies
0
Boosts
0
Views
683
Activity
Mar ’23
[Appclip Bug]: QR hold-menu Appclip launch does not open Appclip
Steps to repro: Create a QR code of a valid Appclip URL embed code on a webpage In safari, tap and hold on the QR image then select 'View APP_CLIP_NAME' AppClip doesn't launch Expected result: Same outcome as tapping the 'View/Open' button on an appclip banner. This issue occurs on all domains and urls, including those registered to the appclip in question.
Replies
1
Boosts
0
Views
958
Activity
Mar ’23
ImageAnalyzer running VNRecognizeTextRequest in the background?
Using VisionKit, there's two main ways to get text from images. ImageAnalyzer VNRecognizeRequest Based on some OCR tests, I'm seeing that the outputs from these two methods are different. Initially, I thought ImageAnalyzer was running VNRequestTextRecognitionLevel.fast because it's for Live Text, but the outputs from ImageAnalyzer are sometimes better than VNRequestTextRecognitionLevel.accurate. Is ImageAnalyzer running VNRequestTextRecognition in the background? Or if it isn't, what pipeline is it using to detect text?
Replies
0
Boosts
2
Views
901
Activity
Dec ’22
QR codes in app
Hi, I am building an app that has a physical good attached to it but you do not pay for the physical good on the app or there is not link what so ever to buy this physical good on the app. I want to verify the physical good so I know it is not a fake on the app through a QR code feature. Do apple allow this function on an app? And if so do they charge commission on doing this, as this is not an in-app purchase, it is simply a verification method?
Replies
0
Boosts
1
Views
1.5k
Activity
Nov ’22
Automate live text copy from Mac preview in image
I have bunch of images in a folder where I'm trying to copy live text from each image and paste it in text file I am trying to use AppleScript to open image in Preview->Text selection-> Command + a but its not selecting live text its just selecting image. I am open to using any swift script to suggest me how to process my images to get live text. Thanks. Apple script tell application "Finder" set fl to files of folder POSIX file "/Users/Data" as alias list end tell repeat with f in fl tell application "Preview" activate open f tell application "System Events" tell its process "Preview" click menu item "Text Selection" of menu "Tools" of menu bar 1 end tell end tell delay 5 tell application "System Events" tell application process "Preview" click at {100, 200} delay 2 keystroke "a" using command down delay 1 end tell end tell delay 30 repeat until (count of windows) > 0 delay 2.0 end repeat close front document end tell end repeat
Replies
0
Boosts
0
Views
1.5k
Activity
Nov ’22
Safari on MacOS overlays block-areas on included images (inserts HTML in real time) - blocking access to my own linked areas!
I include a picture on an HTML page by: <img src="./name.png" class="inline" alt="" usemap="#html"/> I create a link map, defining areas of the picture that I want to link to notes like this: <map name="html"> <area shape="circle" coords="73,250,30" href="./PassiveStrideRecovery_W12_Notes.html" alt="PassiveStrideRecovery_W12" target="_self" /> ...(more of these areas) </map> All the linked areas work fine for a few seconds and then some of the areas are obscured by automatically detected (not well though) areas of interest (to something) in the .png and stops my mouse clicks getting through to some of the linked areas I define. When I use the Debug menu item and examine the HTML source elements (using "Develop->Show Page Source") I created. Initially they include: a minute to so later they change to: indicating the img has acquired some extra structure, which now looks like this: and define some areas, some of which overlay my map areas in a layer above mine. Looking at the last "div" created by MacOS, they seem to be inserted in real-time by Apple Data Detectors. I changed my img include statement to <img src="./GroundContact_W7_Bubbles.png" x-apple-data-detectors="false" class="inline" alt="" usemap="#html"/> but it made no difference. How do I stop real-time area overlay of click-obscuring blocks over pictures included on my HTML page? TIA
Replies
2
Boosts
1
Views
2.8k
Activity
Nov ’22
captureTextFromCamera action is not get triggered in iPad Air (4th gen)
Hi folks, I tried to use apple's text recognition feature by using UIAction.captureTextFromCamera(responder:identifier:). It works fine in iPhone and iPad 3rd Gen. But in iPad 4th Gen the action is not get triggered. Kindly provide assistance . if #available(iOS 15.0, *), self.canPerformAction(#selector(captureTextFromCamera(_:)), withSender: self) {       let cameraAction = UIAction.captureTextFromCamera(responder: self, identifier: nil)       let cameraButton = UIButton(type: .custom)       cameraButton.addAction(cameraAction, for: .touchUpInside)       cameraButton.setTitle("Scan-Text", for: .normal)       view.addSubview(cameraButton)       // Then set constraints     } _Note: The button to trigger the action is visible only the action is not get triggered. _ Device specs: Name: iPad Air 4th Gen Os : iOS 16
Replies
0
Boosts
0
Views
1.1k
Activity
Oct ’22
In Live Text API, text selection or clicking the highlight button on the right does not work
I am implementing Live Text function using ImageAnalysisInteraction and ImageAnalyzer. After loading an image file into UIImageView , I am trying to implement a function to select like a TextView using Live Text function. On the right side of the UIImageView, a button to change the Live Text highlight state is displayed. However, there is a phenomenon that this button cannot be clicked. Also, even if you change the highlight state to Live Text, it is not selected like UITextView. imageView.addInteraction(interaction) I added an interaction to the imageview like this. Even if I keep changing preferredInteractionTypes to multiple types, there is no choice. interaction.view!.isUserInteractionEnabled = true imageView.isUserInteractionEnabled = true So I also changed the isUserInteractionEnabled value to true . Have any of you solved this problem?
Replies
0
Boosts
0
Views
1k
Activity
Oct ’22
Error when using Live Text API
I am developing a function using Live Text. (I used ImageAnalyzer and ImageAnalysisInteraction.) When executed, the following error log is displayed and the Live Text Button is displayed but not clicked or highlighted. That is, it does nothing. [Unknown process name] Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem. [Unknown process name] If you want to see the backtrace, please set CG_NUMERICS_SHOW_BACKTRACE environmental variable. [api] -[CIImage initWithCVPixelBuffer:options:] failed because the buffer is nil. Are there any possible causes and solutions for this not working? Or is there a setting I'm missing in order to use LiveText? Below is part of the code. Changing preferredInteractionTypes to all types doesn't change anything. UIImageViews are displayed by switching left and right through UIPageViewController and calling the LiveText function. Task { var analyzer:ImageAnalyzer? = ImageAnalyzer()             if analyzer == nil {                 return             }             let configuration = ImageAnalyzer.Configuration([.text])             do {                 let pAnalysis = try await analyzer!.analyze(image!, configuration: configuration)                 DispatchQueue.main.async {                                          //interaction!.preferredInteractionTypes = .automatic                     interaction.preferredInteractionTypes = .textSelection                     //interaction!.preferredInteractionTypes = .dataDetectors                     //interaction!.preferredInteractionTypes = [.textSelection, .dataDetectors]                     //interaction.preferredInteractionTypes = [.textSelection, .dataDetectors, .automatic]                     interaction.selectableItemsHighlighted = true                     interaction.analysis = pAnalysis                     interaction.setContentsRectNeedsUpdate()                 }             } catch {}             analyzer = nil }
Replies
0
Boosts
1
Views
1.4k
Activity
Sep ’22
Code to Send SMS to several Phone numbers
Hello Here is my problem. If i scan a QR code which aim is to send SMS to several numbers, IOS will only send a SMS to the first phone number. Code is : SMSTO:NUMBER1:NUMBER2:SMSCONTENT This code will work with any Android device but not with Iphones. I've been calling Apple but they told they don't know how to separate phone numbers in such a Code to do the job. I tried with ";" (works with Android too), space, /, blank, ",+... None of them work. If somebody could help thanks a lot
Replies
1
Boosts
0
Views
1.4k
Activity
Sep ’22
Translation
Text translation not working in iOS 16!
Replies
1
Boosts
0
Views
1.1k
Activity
Sep ’22
Crash
Hello! I found a crash at the start of the app with an error: error: memory read failed for 0x0 Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) If I add to the project: @available(iOS 16.0, *) @MainActor class SomeClass { var configuration: ImageAnalyzer.Configuration? } But if I replace the class with a structure, then the app will run without crash: @available(iOS 16.0, *) @MainActor struct SomeStruct {     var configuration: ImageAnalyzer.Configuration? } Xcode 14.0 beta 5 (14A5294e) iOS 15.6 On iOS 16 beta, both options work, without crashes. Any suggestion as to what to look for?
Replies
2
Boosts
1
Views
1.9k
Activity
Aug ’22