Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] MLKitTextRecognition on IOS 12.5.7 (iPhone 6.0) crashed after migration to Xcode 15.0 #737

Open
haksoy opened this issue Sep 28, 2023 · 1 comment

Comments

@haksoy
Copy link

haksoy commented Sep 28, 2023

Describe the bug
We use IOS MLKitTextRecognition 2.0 version on mobile devices after IOS 11.0 version. With the transition to iOS 17.0, the development environment has been switched to XCode 15.0. When the application tested on IOS 12.5.7 (IPhone 6) after the migration, the app crashed and exited at the "textRecognizer.process(visionImage)" stage. We do not encounter this problem in other IOS versions. Similarly, when switched back and built the same application on XCode 14.3, it worked smoothly on iOS 12.5.7. The problem only exists in XCode 15.0 and IOS 12.x versions and tested with different versions of MLKitTextRecognition (1.0 and.2.0) nothing changed.

To Reproduce

  1. Build the sample app on Xcode 15.0 with different MLKitTextRecognition versions
  2. Test on iPhone 6 (IOS 12.x)
  3. Recognize Latin based text image (either image or from camera capture)
  4. See following crash log on TextRecognition 1.0 version and app exited

Installed Pods on sample app for MLKitTextRecognition 1.0 versions

Installing GTMSessionFetcher (1.7.2)
Installing GoogleDataTransport (9.2.5)
Installing GoogleMLKit (2.2.0)
Installing GoogleToolboxForMac (2.3.2)
Installing GoogleUtilities (7.11.5)
Installing GoogleUtilitiesComponents (1.1.0)
Installing MLImage (1.0.0-beta1)
Installing MLKitCommon (3.0.0)
Installing MLKitTextRecognition (1.3.0)
Installing MLKitVision (1.3.0)
Installing PromisesObjC (2.3.1)
Installing Protobuf (3.24.3)
Installing SnapKit (5.6.0)
Installing nanopb (2.30909.0)

With MLKit TextRecognition 2.0, crash log stack changes, but the error same

  • thread Android Translate showcase fixes #12, name = 'drishti/0', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    • frame #0: 0x0000000000000000
      frame Adding support for devices with long screens #1: 0x0000000100f2b44c MLKitText-[MLKCommonTextRecognizerOptions initWithConfigLabel:bundleName:languageOption:SDKVersion:] + 4925804 frame #2: 0x0000000100e21620 MLKitText-[MLKCommonTextRecognizerOptions initWithConfigLabel:bundleName:languageOption:SDKVersion:] + 3836736
      frame Adding support for devices with long screens #3: 0x0000000100e1a5e0 MLKitText-[MLKCommonTextRecognizerOptions initWithConfigLabel:bundleName:languageOption:SDKVersion:] + 3808000 frame #4: 0x0000000100e1756c MLKitText-[MLKCommonTextRecognizerOptions initWithConfigLabel:bundleName:languageOption:SDKVersion:] + 3795596
      frame outdated dependencies used  #5: 0x0000000100e16e38 MLKitText-[MLKCommonTextRecognizerOptions initWithConfigLabel:bundleName:languageOption:SDKVersion:] + 3793752 frame #6: 0x0000000101ba0400 MLKitText-[MLKCommonTextRecognizerOptions initWithConfigLabel:bundleName:languageOption:SDKVersion:] + 17987872
      frame Adding support for devices with long screens #7: 0x0000000101b90fd4 MLKitText-[MLKCommonTextRecognizerOptions initWithConfigLabel:bundleName:languageOption:SDKVersion:] + 17925364 frame #8: 0x0000000101b90d14 MLKitText-[MLKCommonTextRecognizerOptions initWithConfigLabel:bundleName:languageOption:SDKVersion:] + 17924660
      frame Android code snippets: Update examples to show how to use default options #9: 0x0000000101bf8e3c MLKitText-[MLKCommonTextRecognizerOptions initWithConfigLabel:bundleName:languageOption:SDKVersion:] + 18350940 frame #10: 0x0000000101bf8b14 MLKitText-[MLKCommonTextRecognizerOptions initWithConfigLabel:bundleName:languageOption:SDKVersion:] + 18350132
      frame Crash running iOS/quickstarts/TranslateExample #11: 0x00000001c41312c0 libsystem_pthread.dylib_pthread_body + 128 frame #12: 0x00000001c4131220 libsystem_pthread.dylib_pthread_start + 44
      frame Update top-level README #13: 0x00000001c4134cdc libsystem_pthread.dylib`thread_start + 4

Installed pods for MLKitTextRecognition 2.0 version

Installing GTMSessionFetcher (2.3.0)
Installing GoogleDataTransport (9.2.5)
Installing GoogleMLKit (4.0.0)
Installing GoogleToolboxForMac (2.3.2)
Installing GoogleUtilities (7.11.5)
Installing GoogleUtilitiesComponents (1.1.0)
Installing MLImage (1.0.0-beta4)
Installing MLKitCommon (9.0.0)
Installing MLKitTextRecognition (2.0.0)
Installing MLKitTextRecognitionCommon (1.0.0)
Installing MLKitVision (5.0.0)
Installing PromisesObjC (2.3.1)
Installing SnapKit (5.6.0)
Installing nanopb (2.30909.0)

If applicable, please include code snippet and sample input(image, video, text, etc)

private lazy var textRecognizer = TextRecognizer.textRecognizer()

@objc func onStart(_ sender: UIButton) {
    let image = imageView.image!
    let visionImage = VisionImage(image: image)
    visionImage.orientation = image.imageOrientation
    textRecognizer.process(visionImage) { features, error in
      self.processResult(from: features, error: error)
    }
  }

SDK Info:

  • SDK Name & Version [MLKitTextRecognition (2.0.0) and MLKitTextRecognition (1.3.0)]

Smartphone:

  • Device/Simulator: [iPhone6]
  • Device/Simulator OS: [12.5.7]

Development Environment:

  • IDE Eversion: [Xcode 15.0]
  • Laptop/Desktop: [Mac Mini M1 (2020)]
  • Laptop/Desktop OS/version: [macOS Ventura 13.5.2]
@haksoy
Copy link
Author

haksoy commented Oct 9, 2023

I have found a workaround solution to run MLKitTextRecognition app built on Xcode 15.X to run on IOS 12.X. Sharing it here to help those who may encounter the problem.

With the transition to XCode 15 and IOS 17, Apple changed the static linker (ld64) that it had been using for a long time and created a static linker called ld_prime, which it said was more optimized. This linker is causing the crash on MLKitTextRecognition. You can add "-ld64" or "-ld_classic" to Other Linker Flags to force old linker usage and try to avoid this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@haksoy and others