learning icon indicating copy to clipboard operation
learning copied to clipboard

Fix swift compiler errors

Open mityax opened this issue 3 years ago • 14 comments

This fixes various issues the swift compiler complained about when I tried to build my app for iOS. Not sure whether this is due to a new swift version or something else, this was actually the first swift code I ever worked on at all.

Closes #18

mityax avatar Jan 22 '22 05:01 mityax

Can you please merge this request, I cannot build because it keeps saying No such module 'MLKit'

rainaakshay avatar Mar 28 '22 08:03 rainaakshay

@rainaakshay I didn't see that file name in the iOS classes and created it. However, when I try to compile now, I am getting the error: Swift Compiler Error (Xcode): No such module 'MLKitTranslate' in /learning-master/ios/Classes/SwiftLearningTranslatePlugin.swift:3:7

Did you see this error at all?

seth35us avatar Mar 28 '22 15:03 seth35us

@seth35us No I didn’t try manually changing the file as it will be overwritten on flutter pub get anyways. @salkuadrat merging this pull request will probably solve all these issues.

rainaakshay avatar Mar 28 '22 16:03 rainaakshay

@rainaakshay @seth35us yes it does. I'm using the plugin successfully now on iOS and Android.

I'm not sure how actively maintained this is though, the author's last actvitiy was on 23rd Nov. If you need it to work fast, you can just use my fork directly in your pubspec.yaml, until this is merged:

  learning_translate:
    git:
      url: https://github.com/mityax/learning_translate.git

mityax avatar Mar 29 '22 03:03 mityax

@mityax Great news that you got it working. I just read your message, so will try it out first thing tomorrow morning. Very much appreciated.

seth35us avatar Mar 29 '22 05:03 seth35us

@mityax Can I use your fork for entity extraction as well?

rainaakshay avatar Mar 29 '22 10:03 rainaakshay

@rainaakshay It wouldn't make a difference, I haven't changed anything there.

mityax avatar Mar 29 '22 11:03 mityax

@mityax After commenting everything except translation and object detection, I got the app to run with your code. However, I am getting a missing channel error when trying to do any object detection. Similar issues are #4 and #3. Is the object detection working for you on iOS, or is it not implemented?

The only other package I found to do object detection is tflite and it wouldn't compile for me on iOS.

seth35us avatar Mar 29 '22 14:03 seth35us

@mityax Did you get any error like this after your changes?

Undefined symbols for architecture x86_64:
      "_OBJC_CLASS_$_MLKEntityAnnotation", referenced from:
          objc-class-ref in SwiftLearningEntityExtractionPlugin.o
      "_OBJC_CLASS_$_MLKModelDownloadConditions", referenced from:
          objc-class-ref in SwiftLearningEntityExtractionPlugin.o
      "_OBJC_CLASS_$_MLKEntityExtractionParams", referenced from:
          objc-class-ref in SwiftLearningEntityExtractionPlugin.o
      "_OBJC_CLASS_$_MLKEntityExtractor", referenced from:
          objc-class-ref in SwiftLearningEntityExtractionPlugin.o
      "_OBJC_CLASS_$_MLKEntityExtractionRemoteModel", referenced from:
          objc-class-ref in SwiftLearningEntityExtractionPlugin.o
      "_OBJC_CLASS_$_MLKModelManager", referenced from:
          objc-class-ref in SwiftLearningEntityExtractionPlugin.o
      "_OBJC_CLASS_$_MLKEntityExtractorOptions", referenced from:
          objc-class-ref in SwiftLearningEntityExtractionPlugin.o

I made the changes in SwiftLearningEntityExtractionPlugin.swift just like you did in SwiftLearningTranslatePlugin.swift, but mine keeps throwing this error

rainaakshay avatar Mar 29 '22 20:03 rainaakshay

@rainaakshay No, I haven't encountered anything like that. I can't help you, I'm afraid

mityax avatar Mar 29 '22 21:03 mityax

@seth35us I have only used language identification and translation - no idea about the others

mityax avatar Mar 29 '22 21:03 mityax

I noticed that most of the APIs in this plugin are only implemented for Android, and some for iOS, this other plugin works for me: google_ml_kit and has the same functionalities.

fbernaly avatar Apr 28 '22 21:04 fbernaly

@fbernaly This plugin was meant as a substitute for the official google ml kit that you mentioned, since at that time google_ml_kit was missing a lot of ios implementations like entity extraction and text recognition v2. Which were supported in this plugin, it was just not maintained.

rainaakshay avatar Apr 28 '22 21:04 rainaakshay

Great, it is supported now.

fbernaly avatar Apr 28 '22 22:04 fbernaly